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

Support more options for openapi3 responses #59

Merged
merged 5 commits into from
Jan 12, 2024

Conversation

ngoral
Copy link
Contributor

@ngoral ngoral commented Jan 10, 2024

This request adds missing support for parsing responses with the same status code, but different content types. E.g.:

...
responses:
  '200':
    description: Foo
    content:
      application/json:
        ...
      text/plain:
        ...

It also adds good support for using $ref in a responses like this:

...
responses:
  '404':
    $ref: '#/components/responses/404NotFound'

...

components:
  responses:
    404NotFound:
      description: ...
      content: ...

And also add support for responses without payloads:

...
responses:
  '404':
    description: Not found

@ngoral
Copy link
Contributor Author

ngoral commented Jan 10, 2024

@tuwilof I made a small refactoring, hope it doesn't bother you.

Now tests are failing because more info has appeared about responses that use references (for example 404s ones). But I think now it is working right because there was information missing: there was no schema.
If replacing application/json with application/vnd.api+json does not seem right, I can stub this and some more cases if you can see them now.

What do you think?

@tuwilof
Copy link
Owner

tuwilof commented Jan 10, 2024

Thanks, this refactoring is good.

Yes, now the work is going right.

You can change the speed.json test file so that the test doesn't fail, and then I'll merge PR.

@ngoral
Copy link
Contributor Author

ngoral commented Jan 11, 2024

Ok, I'll change it.

Only seems that it breaks compatibility...
I would like to pull a new version in fitting after this PR is accepted and new version of gem is out...

@ngoral ngoral force-pushed the support_ref_in_openapi3_responses branch from ef81d3d to 47d8389 Compare January 11, 2024 14:29
@ngoral ngoral changed the title Support $ref and multiple content_type for one status in openapi3 responses Support more options for openapi3 responses Jan 11, 2024
@tuwilof tuwilof merged commit e0c8a07 into tuwilof:master Jan 12, 2024
1 check passed
@tuwilof
Copy link
Owner

tuwilof commented Jan 12, 2024

I have published your changes in the new version of the tomograph 3.2.0

@ngoral ngoral deleted the support_ref_in_openapi3_responses branch January 16, 2024 12:09
@ngoral
Copy link
Contributor Author

ngoral commented Jan 16, 2024

Thank you so much for being so cooperative!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants