Skip to content

Conversation

@laerciosb
Copy link

First of all, the project is amazing and is serving me perfectly. I hope it continues to evolve for a long time.
Well, I found a problem when generating the openapi from the request of a put method. The required field is generated empty and this results in an error when reading the file as shown in the images below:

2023-04-28_12-16

2023-04-28_12-05

To fix the error, I simply removed the required field if it was empty.

@exoego
Copy link
Owner

exoego commented Apr 28, 2023

Thanks for the report and even a pull request!
The issue is reproducible with Swagger Editor on my side.

That place (inside cleanup_hash!) is a not place to be fixed.
cleanup_hash! used not only for paths field but also for many places, so adding that logic put unnecessary computation.

I think such empty array clean up added between ~~.cleanup! and ~~update! here:

RSpec::OpenAPI::SchemaCleaner.cleanup!(spec, new_from_zero)
RSpec::OpenAPI::ComponentsUpdater.update!(spec, new_from_zero)
end

It would be great if you add test to verify new behavior.

I will look if you find it difficult.

@exoego
Copy link
Owner

exoego commented Apr 29, 2023

@laerciosb Thanks for your PR.
I've fixed the issue in #111 and published v0.8.1.

@exoego exoego closed this Apr 29, 2023
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