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

Pass extension documentation into schema #64

Merged

Conversation

numbata
Copy link
Contributor

@numbata numbata commented Jan 30, 2024

This PR allows to handle x- extension documentation specifically for object type fields in the OpenAPI schema.

For example, it helps to make some fields nullable without modifying the referenced object type with a x-nullable: true option like:

expose :foo, using: Foo, documentation: {description: "A foo nullable relation", x: { nullable: true } }

and have in the schema:

      foo:
        "$ref": "#/definitions/Foo
        x-nullable: true
        description: A foo nullable relation

@numbata
Copy link
Contributor Author

numbata commented Jan 31, 2024

@LeFnord @mscrivo Can you have a look at the PR, please?

@mscrivo
Copy link
Collaborator

mscrivo commented Jan 31, 2024

Looks good to me, can we add a test to validate the expected behavior?

@numbata
Copy link
Contributor Author

numbata commented Jan 31, 2024

Actually, I just modified the current one, to ensure that it works as expected.
https://github.com/ruby-grape/grape-swagger-entity/pull/64/files#diff-a82dc4f43547c50c91c3c7c0c0fd378a6c0eacc0b0d3272ec419796ddb44de2fR63-R64

@numbata
Copy link
Contributor Author

numbata commented Jan 31, 2024

Also, I see that the workflow should be updated with a new Ruby version. I will do it in a separate PR.

@mscrivo
Copy link
Collaborator

mscrivo commented Jan 31, 2024

also don't forget to add an entry to the changelog

@numbata
Copy link
Contributor Author

numbata commented Jan 31, 2024

Also, I see that the workflow should be updated with a new Ruby version. I will do it in a separate PR.

done here: #65

@numbata
Copy link
Contributor Author

numbata commented Jan 31, 2024

also don't forget to add an entry to the changelog

done here 7245469.

@numbata
Copy link
Contributor Author

numbata commented Feb 2, 2024

@mscrivo Thank you for approval!
:fyi: Currently omw in making a PR with updating dependencies for the grape's danger gem.
It should unblock #65 which should unblock this PR.

@mscrivo
Copy link
Collaborator

mscrivo commented Feb 2, 2024

Thanks! Will merge this in and try to figure out the danger issues separately and get a release out asap.

@mscrivo mscrivo merged commit 2a13b1b into ruby-grape:master Feb 2, 2024
4 of 5 checks passed
@mscrivo
Copy link
Collaborator

mscrivo commented Feb 2, 2024

@mscrivo Thank you for approval! :fyi: Currently omw in making a PR with updating dependencies for the grape's danger gem. It should unblock #65 which should unblock this PR.

Ah I missed this, I had started down the same path: ruby-grape/danger#11 Is that what you were thinking as well?

@numbata
Copy link
Contributor Author

numbata commented Feb 2, 2024

Yeah, the same path. Answered here: #65 (comment)

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.

2 participants