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

add examples of response body #3

Merged
merged 1 commit into from
Jun 22, 2020
Merged

Conversation

uiur
Copy link
Contributor

@uiur uiur commented Jun 22, 2020

This is changes to save examples of response body in openapi schema

ref: https://swagger.io/docs/specification/adding-examples/

You can see them as response samples in docs:

image

But it might be a problem when you run this spec because the schema output becomes dynamic:

% OPENAPI=1 bundle exec rspec spec/requests/tables_spec.rb
...
An error occurred in an `after(:suite)` hook.
Failure/Error: expect(system('git', 'diff', '--exit-code', '--', RSpec::OpenAPI.path)).to eq(true)

  expected: true
       got: false

  (compared using ==)

  Diff:
  @@ -1,2 +1,2 @@
  -true
  +false

Copy link
Collaborator

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

But it might be a problem when you run this spec because the schema output becomes dynamic:

That after(:suite) hook (and deletion of schema at before(:suite)) is for testing rspec-openapi itself, and in normal usage it doesn't update existing fields because of how it merges generated schema. So I think it doesn't continue to change existing examples forever and it's not a big issue until we try to implement a way to merge auto-generated schema intelligently.

@k0kubun k0kubun merged commit 0cb8b3f into exoego:master Jun 22, 2020
@uiur uiur deleted the save-response-example branch June 23, 2020 03:49
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