Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fetch/axios): correctly merge headers from opts #231

Merged
merged 16 commits into from
Aug 17, 2024
Merged
40 changes: 40 additions & 0 deletions e2e/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,32 @@ info:
title: E2E Tests for @nahkies/openapi-code-generator
version: "0.0.1"
tags:
- name: headers
- name: validation
paths:
/headers/undeclared:
get:
tags:
- headers
responses:
200:
$ref: '#/components/responses/GetHeaders'
/headers/request:
get:
tags:
- headers
parameters:
- name: route-level-header
in: header
schema:
type: string
- name: Authorization
in: header
schema:
type: string
responses:
200:
$ref: '#/components/responses/GetHeaders'
/validation/numbers/random-number:
get:
tags:
Expand Down Expand Up @@ -38,6 +62,22 @@ paths:
$ref: '#/components/schemas/RandomNumber'

components:
responses:
GetHeaders:
description: success
content:
application/json:
schema:
type: object
properties:
headers:
additionalProperties:
anyOf:
- type: string
- type: array
items:
type: string

schemas:
RandomNumber:
type: object
Expand Down
12 changes: 9 additions & 3 deletions e2e/scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ yarn openapi-code-generator \

yarn openapi-code-generator \
--input ./openapi.yaml \
--output ./src/generated/client \
--output ./src/generated/client/fetch \
--template typescript-fetch \
--schema-builder zod \
--extract-inline-schemas \
--grouping-strategy first-tag \
--extract-inline-schemas

yarn openapi-code-generator \
--input ./openapi.yaml \
--output ./src/generated/client/axios \
--template typescript-axios \
--schema-builder zod \
--extract-inline-schemas
88 changes: 88 additions & 0 deletions e2e/src/generated/client/axios/client.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions e2e/src/generated/client/axios/models.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 0 additions & 38 deletions e2e/src/generated/client/client.ts

This file was deleted.

79 changes: 79 additions & 0 deletions e2e/src/generated/client/fetch/client.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions e2e/src/generated/client/fetch/models.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions e2e/src/generated/client/models.ts

This file was deleted.

16 changes: 16 additions & 0 deletions e2e/src/generated/models.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading