We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello folks.
It seems that msw-auto-mock can't generate handlers if you have a schema that's using allOf in collaboration with two refs.
msw-auto-mock
allOf
As an example if you take the following schema from the Trains OpenAPI example spec
/bookings: get: operationId: get-bookings summary: List existing bookings description: Returns a list of all trip bookings by the authenticated user. tags: - Bookings responses: '200': description: A list of bookings headers: RateLimit: $ref: '#/components/headers/RateLimit' content: application/json: schema: allOf: - $ref: '#/components/schemas/Wrapper-Collection' - properties: data: type: array items: $ref: '#/components/schemas/Booking' - properties: links: allOf: - $ref: '#/components/schemas/Links-Self' - $ref: '#/components/schemas/Links-Pagination' example: data: - id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e trip_id: efdbb9d1-02c2-4bc3-afb7-6788d8782b1e passenger_name: John Doe has_bicycle: true has_dog: true - id: b2e783e1-c824-4d63-b37a-d8d698862f1d trip_id: b2e783e1-c824-4d63-b37a-d8d698862f1d passenger_name: Jane Smith has_bicycle: false has_dog: false links: self: https://api.example.com/bookings next: https://api.example.com/bookings?page=2 application/xml: schema: allOf: - $ref: '#/components/schemas/Wrapper-Collection' - properties: data: type: array xml: name: bookings wrapped: true items: $ref: '#/components/schemas/Booking' - properties: links: allOf: - $ref: '#/components/schemas/Links-Self' - $ref: '#/components/schemas/Links-Pagination' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '429': $ref: '#/components/responses/TooManyRequests' '500': $ref: '#/components/responses/InternalServerError'
This generates:
export function getGetBookings200Response() { return { data: [...new Array(faker.number.int({ min: 1, max: MAX_ARRAY_LENGTH })).keys()].map( (_) => ({}), ), links: {}, } }
Are my expectations wrong ? Or it's a case of the library currently doesn't support it and needs to be implemented.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello folks.
It seems that
msw-auto-mock
can't generate handlers if you have a schema that's usingallOf
in collaboration with two refs.As an example if you take the following schema from the Trains OpenAPI example spec
This generates:
Are my expectations wrong ? Or it's a case of the library currently doesn't support it and needs to be implemented.
The text was updated successfully, but these errors were encountered: