1

Say I have a reusable component:

  parameters:
    ResourceName:
      in: path
      name: name
      description: The name of the Resource (See tag for resource)
      schema:
        type: string
      required: true

I have a use for this component across several endpoints, and the identifier that I see for these endpoints is the tag. Can I insert the tag name in the description as its inserted?

An example implementation in an operation

        tags:
         - SampleResourceName
        parameters:
         - $ref: '#/components/parameters/ResourceName'

How can I insert SampleResourceName in the description of the parameter, IE:

  parameters:
    ResourceName:
      in: path
      name: name
      description: The name of the {tag}
      schema:
        type: string
      required: true
Mike
  • 179
  • 1
  • 1
  • 10

1 Answers1

1

OpenAPI and YAML do not support variable placeholders.

But you can write a script that would parse your OpenAPI file and process it the way you need. Check out Use placeholders in YAML which contains links to YAML extension libraries that can help you with this.

Helen
  • 87,344
  • 17
  • 243
  • 314