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

The generated type names for the headers and queries should be Ballerina friendly #6961

Closed
TharmiganK opened this issue Sep 4, 2024 · 0 comments · Fixed by ballerina-platform/openapi-tools#1768

Comments

@TharmiganK
Copy link
Contributor

Description:

When there are queries and headers for a particular operation, those are represented as record types in the client generation. The record type names are inferred from the operation id. Those auto-generated type names should be align with the Ballerina naming conventions

Identified from: #6906

Steps to reproduce:

Please use the following OpenAPI specification to reproduce the issue:

openapi: 3.0.1
info:
  title: PayloadV
  version: 0.0.0
servers:
- url: "http://{server}:{port}/payloadV"
  variables:
    server:
      default: localhost
    port:
      default: "8080"
paths:
  /albums:
    get:
      operationId: Get_Albums_Id
      parameters:
      - name: q1
        in: query
        required: false
        style: form
        explode: true
        schema:
          type: string
      - name: q2
        in: query
        required: false
        style: form
        explode: true
        schema:
          type: integer
          format: int64
      - name: X-HEADER
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                type: object

The generated resource function signature:

resource isolated function get albums(Get_Albums_IdHeaders headers = {}, *Get_Albums_IdQueries queries) 
       returns record {}|error {
   ...
}

Describe your solution(s)

The names should be properly sanitized like this:

resource isolated function get albums(GetAlbumsIdHeaders headers = {}, *GetAlbumsIdQueries queries) 
       returns record {}|error {
   ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant