-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Super scaffolding any model causes the OpenAPI test to start failing #1520
Comments
@newstler, wondering if you have any suggestions on how we can handle this better. |
After poking around at this for a while I found that I could get the test to pass by updating It started like this: FactoryBot.define do
factory :widget do
association :team
name { "MyString" }
end
end And once I did this, the test started passing: FactoryBot.define do
factory :widget do
association :team
name { "MyString" }
factory :widget_example do
id { 42 }
team { FactoryBot.example(:team) }
end
end
end I think we either need to update the scaffolding process to automatically add the |
An example factory like this also works: factory :widget_example do
id { 42 }
team_id { 42 }
end (Hard coding a |
After looking at this some more I think maybe our test is just overly fragile. The "failures" are actually just letting you know about warnings issued by redocly. I'm not sure we should fail the tests just due to warnings. These are the lines causing the problem: bullet_train/test/controllers/api/open_api_controller_test.rb Lines 18 to 20 in e26545d
I'm currently thinking that we shouldn't lump together warnings and failures from redocly and treat them all as failures. Instead I think that we should separate them and only treat redocly failures as failures. And then just output a message if there are warnings. Maybe something like: failures = output.match("Failed to parse api definition")
puts output if failures
refute failures
warnings = output.match(/You have (\d+) warnings/)
if warnings
puts "-----------------".yellow
puts warnings.yellow
puts "-----------------".yellow
end @newstler do you see any problems with doing something like this? |
Hey, I’m sorry I haven’t seen that due to absence of notifications on GitHub some why. You’re right saying that the solution would be to update the scaffolding process to automatically add the I wouldn't change the test itself though, as redocly's warnings are basically OpenAPI errors, meaning the documentation is noncompliant. |
I'm hitting this issue as well on a new project. I think I have a handle on what it may be and how to fix. Hope to get a PR stood up later today. |
bin/configure
&bin/setup
rails test
- everything passesrails g super_scaffold Widget Team name:text_field
rails db:migrate
rails test
- The OpenAPI test failsHere's the complete output of running just that test after super scaffolding a simple model. Seems like we should be able to generate models and whatever they need to pass this basic test.
It's also worth mentioning that the output from this failure isn't particularly helpful in pointing out what exactly failed. It points to
./tmp/openapi.yaml
which is an auto generated file. It would be nice if we could point you towards whatever file you'd need to touch to make changes.The text was updated successfully, but these errors were encountered: