2

I'm trying to define the same GET endpoint but with two different group of parameters (because depending on the parameters you provide, the endpoint filters one way or the other). Something like this:

paths:
  /:
    get:
      parameters:
          - in: query
            name: parameter1
            schema:
                type: number
          - in: query
            name: parameter2
            schema:
                type: number
  /:
    get:
      parameters:
          - in: query
            name: parameter3
            schema:
                type: number
          - in: query
            name: parameter4
            schema:
                type: number

As you may have noticed, that returns an error because the key / is duplicated. So what I want to do it's something like this:

paths:
  /:
    get:
      parameters:
        oneOf:
          - $ref: paramGroup1
          - $ref: paramGroup2

But that gives me an invalid syntax error. I cannot put all query parmeters together because they have to be used separately (due to the nature of the filtering we are implementing). So, any idea about how this can be achieved?

Antonio Gamiz Delgado
  • 1,871
  • 1
  • 12
  • 33
  • 1
    See [this answer](https://stackoverflow.com/a/49199240/113116). A related feature request in the OpenAPI repo: [Support an operation to have multiple specifications per path (e.g. multiple POST operation per path)](https://github.com/OAI/OpenAPI-Specification/issues/182) – Helen Dec 13 '21 at 08:24
  • great! I found there the solution. Please post it as an answer! – Antonio Gamiz Delgado Dec 13 '21 at 20:53

0 Answers0