Skip to content

Is it possible to have a PathItem.Parameter as a ref? #416

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

Open
Anthony-Bible opened this issue May 17, 2025 · 0 comments
Open

Is it possible to have a PathItem.Parameter as a ref? #416

Anthony-Bible opened this issue May 17, 2025 · 0 comments

Comments

@Anthony-Bible
Copy link

Similar to #25, but in the reverse I want to be able to render to a ref:

paths:
  /test:
    get:
      operationId: getTest
      parameters:
        - $ref: '#/components/parameters/test' # This here

But it seems like the only potential option is possibly resolving the ref to the full yaml currently? The problem with this is we may use the ref in many places so that could increase our Openapi file by thousands of lines.

Just for a full picture, we're doing a protobuf to openapi spec and using this library to render the openapi:

This is the rpc:

  rpc GetUser(GetUserRequest) returns (User) {
    option (google.api.http) = {get: "/users"};
    option (google.api.method_signature) = "name";
    option (gnostic.openapi.v3.operation) = {
      description: "Get a user" // this will overwrite the comment above the rpc
      tags: "users" // this is used to group the operations in the gnostic.openapi spec, by default it only contains the service name
      operation_id: "GetUsers" // this by default is service_name + '_' + method_name

      // This refers to the header defined in the document option above, it will automatically document the header when converted to gnostic.openapi/json spec
      // it's currently commented out until our generation tool has support for it, once support is enabled we will uncomment this
      parameters: {reference: {_ref: "#/components/parameters/filter_mask"}}"#/components/parameters/filter_mask"
      };
}

We would like to render it like:

...
paths:
  /users:
    get:
      description: Get a User
      operation_id: GetUsers
      parameters:
        - $ref: "#/components/parameters/filter_mask"

The closest I can find is creating a proxy schema but that's only doing a ref for schemas so you'd still have lots of repeating lines.

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

No branches or pull requests

1 participant