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

Enhancement: raise Error if param with the same variable is re-declared #22

Open
dukeraphaelng opened this issue May 12, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@dukeraphaelng
Copy link
Contributor

Currently it is possible to declare a param with the same variable more than once.

Example in a method-based framework

@[OpenAPI(
<<-YAML
  summary: get index
YAML
)]
def index
      limit1 = param(limit : Int32? = 100, description: "Page's limit")
      offset1 = param(offset : Int32? = 0, description: "Page's offset")
      limit2 = param(limit : Int32? = 100, description: "Items per page")
      offset2 = param(offset : Int32? = 0, description: "Page offset")

      render json: "index", type: String
end

This would render the following schema

  /api/portal/v1/instances:
    get:
      summary: get index
      parameters:
      - name: limit
        in: query
        description: Page's limit
        required: false
        schema:
          type: integer
      - name: offset
        in: query
        description: Page's offset
        required: false
        schema:
          type: integer
      - name: limit
        in: query
        description: Items per page
        required: false
        schema:
          type: integer
      - name: offset
        in: query
        description: Page offset
        required: false
        schema:
          type: integer
      responses:
        "200":
          description: OK
          content:
            text/yaml:
              schema:
                type: String

A compiler error should be raised if the param with the same variable is declared. more than once.

@elbywan elbywan added the enhancement New feature or request label May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants