Skip to content

Conversation

@Anaethelion
Copy link
Contributor

This PR adds a new function to embed the specific behaviors properties CommonQueryParameters and CommonCatQueryParameters in the query parameters list whenever they are present in a request as attachedBehaviors.

This adds the following query parameters to the OpenAPI export:

  • Adds error_trace, filter_path, human, pretty from CommonQueryParameters
  • Adds format, h, help, local, master_timeout, s and v from CommonCatQueryParameters
Copy link
Contributor

@swallez swallez left a comment

Choose a reason for hiding this comment

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

Why is this in expand_generics.rs? This is needed for the Schema.json to OpenAPI conversion, so should be better located in the clients_schema_to_openapi crate. The best place for this is probably schemas.rs in the "Prepare query parameters" section.

Also we should match on behaviors and not attached_behaviors since the latter is set on the type that has the behavior, but also all of its subtypes. Using it duplicates the common parameters on every subtype.

(IMHO attached_behaviors should be removed but this is another issue)

namespace: "_spec_utils".into(),
name: behavior.into(),
};
if let Ok(def) = model.get_interface(&new_type_name) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using let def model.get_interface(&new_type_name)? avoids to silently ignore a missing definition for the behavior.

@Anaethelion
Copy link
Contributor Author

After an internal discussion, we've decided it is best to refactor the *Common*QueryParameters pattern instead.

Closing this draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants