ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
137 stars 58 forks source link

Required header/query parameter are not generated with the default value #6952

Closed TharmiganK closed 3 weeks ago

TharmiganK commented 3 weeks ago

Description:

$Subject

Identified from: https://github.com/ballerina-platform/ballerina-library/issues/6906

Steps to reproduce:

Please use the following OpenAPI specification to reproduce the issue:

openapi: 3.0.1
info:
  title: Service Openapi Yaml
  version: 0.0.0
servers:
- url: "http://{server}:{port}/"
  variables:
    server:
      default: localhost
    port:
      default: "8080"
paths:
  /albums/{id}:
    get:
      operationId: getAlbumsId
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: q1
        in: query
        schema:
          type: string
          default: query1
      - name: q2
        in: query
        required: true
        schema:
          type: integer
          format: int64
          default: -1
      - name: X-HEADER
        in: header
        required: true
        schema:
          type: string
          default: header1
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Album'
components:
  schemas:
    Album:
      required:
      - author
      - title
      type: object
      properties:
        iid:
          type: integer
          format: int64
        title:
          type: string
          default: Unknown
        author:
          type: string
          default: Unknown
      additionalProperties: false

Generated types:

Affected Versions:

Ballerina SwanLake Update 10(2201.10.x)

github-actions[bot] commented 3 weeks ago

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.