Skip to content
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

OpenApi Parameter "Reference Object" are ignored #59

Open
tom-inetum-realdolmen opened this issue Jan 12, 2023 · 0 comments
Open

OpenApi Parameter "Reference Object" are ignored #59

tom-inetum-realdolmen opened this issue Jan 12, 2023 · 0 comments

Comments

@tom-inetum-realdolmen
Copy link

Defect

Consider the following openapi doc:

openapi: 3.0.3
info:
  title: Parameter ReferenceObject
  description: test
  version: '1'
  termsOfService: https://www.google.be
  contact:
    email: [email protected]
security:
  - basicAuth: []
servers:
  - url: http://localhost
    description: local host
paths:
  /subject:
    get:
      summary: Test
      operationId: doTest
      parameters:
        - in: query
          name: firstParam
          schema: 
           type: string
        - $ref: "#/components/parameters/FromDateTime"
        - in: query
          name: secondParam
          schema:
            $ref: "/components/schemas/SecondParam"
      responses:
       ... (abbreviated for clarity)
components:
  schemas:
    SecondParam:
      type: string

  parameters:
    FromDateTime:
      in: query
      name: fromDateTime
      required: false
      schema: 
        type: string

Definition:

When parsing this, the controller will have both parameters (firstParam and fromDateTime), however if at runtime values are provided for fromDateTime they are not sent to the corresponding controller file.

The controller function 'doTest' will have 6 variables: req, res, next, firstParam, fromDateTime, secondParam

Actual behavior

example1

GET /subject?firstParam=test&fromDateTime=2022-01-01

  • firstParam=test
  • fromDateTime=undefined
  • secondParam=undefined

If a value is provided for 'secondParam', the controller will have that value in 'fromDateTime' and not in 'secondParam' at runtime.

example 2

GET /subject?fromDateTime=2022-01-01&secondParam=testing

controller function 'doTest' variables:

  • firstParam='2022-01-01'
  • fromDateTime=testing
  • secondParam=undefined

Expected behavior

Of course I'd like the proper parameters to receive the proper value

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