-
Notifications
You must be signed in to change notification settings - Fork 74
AAP-49223 Fix missing query parameters openapi spec #765
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
base: devel
Are you sure you want to change the base?
AAP-49223 Fix missing query parameters openapi spec #765
Conversation
14424b6
to
d45c842
Compare
d45c842
to
3a69d91
Compare
DVCS PR Check Results: PR appears valid (JIRA key(s) found) |
|
for field in model._meta.get_fields(): | ||
if self._is_simple_field(field): | ||
model_fields.append(field.name) | ||
return model_fields[:10] # Limit to avoid overwhelming the schema |
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.
Is this really an issue? It seems like we should include all the fields.
# Basic exact match parameter | ||
parameters.append(self._create_parameter(field_name, f'Filter by {field_name} (exact match)')) | ||
|
||
# Add field-type specific parameters |
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.
Does the presence of each of these filter types enable/disable the use of it from ATF? Or can they be used anyway (including things like isnull, regex, etc. that aren't included at all)?
I am wondering if it's worth filtering some things like created, modified since those are everywhere and seem less likely to be filtered than the model specific fields. And it would probably substantially reduce the schema size.
parameters = [] | ||
|
||
# Add the ordering parameters | ||
for param_name in ['order', 'order_by']: |
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'm thinking order isn't appropriate here, but could be wrong. In gateway at least, the models that do have an order field use it for other purposes (like hierarchical ordering, application/usage order, etc.). order_by on the other hand is for ordering the query results.
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.
Ope, nevermind. I see it isn't a field but a param and the order by backend supports both. Ignore!
Description
OpenApiFilterExtension
part of drf-spectacular(https://drf-spectacular.readthedocs.io/en/latest/drf_spectacular.html#drf_spectacular.extensions.OpenApiFilterExtension) to have granular control of how the schema gets populated.Type of Change
Self-Review Checklist
Additional Context
Assited by AI. Cursor on claude-4-sonnet model.
Screenshots/Logs
Snippet of the swagger view of the API schema:
