-
Notifications
You must be signed in to change notification settings - Fork 141
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
Automatically generate an OpenApi specification #945
Conversation
debca55
to
80710d0
Compare
6d5fa89
to
d2c8569
Compare
This mostly just populates the schema from the models, not building out the paths yet |
d2c8569
to
a4ef7b5
Compare
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
a4ef7b5
to
f433e0f
Compare
29f8b8e
to
cd87acd
Compare
cd87acd
to
f4cbd29
Compare
"title" => "API", | ||
"description" => "REST API" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches what GET /api
returns:
{
"name": "API",
"description": "REST API",
"version": "4.4.0-pre",
a294d39
to
e178452
Compare
0b31fd2
to
c5ffa6e
Compare
next unless collection.klass | ||
|
||
model = collection.klass.constantize | ||
schema_name = model.name.gsub("::", "_") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7bba8c5
to
72d76c6
Compare
properties_value["type"] = "string" | ||
properties_value["format"] = "date-time" | ||
when :integer | ||
if key == model.primary_key || key.ends_with?("_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started using model.reflections
to get the list of foreign_keys but some of our models define the associations in subclasses so some were being marked not as IDs.
# are ignored | ||
if value.comment.present? | ||
if properties_value.key?("$ref") | ||
properties_value = {"allOf" => [properties_value, {"description" => value.comment}]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a description on a foreign_key we have to use allOf: []
because any other properties with a $ref
are ignored
Checked commits agrare/manageiq-api@4271664~...c482f83 with ruby 2.7.8, rubocop 1.56.3, haml-lint 0.51.0, and yamllint |
@Fryguy believe I addressed all existing comments, PTAL |
Passes validation https://editor-next.swagger.io/
TODO
#717