OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.44k stars 6.48k forks source link

[BUG] UNKNOWKN_BASE_TYPE #18909

Closed hesi726 closed 1 month ago

hesi726 commented 3 months ago
Description

when product csharp code, it will the follows code

void CreateOrUpdateAudienceCategoryByUUID(string envId, string audienceCategoryUuid, UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE);

openapi-generator version

7.6.0

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Media Owner Full-Stack API
  version: 1.0.89
  x-api-id: d0184f38-b98d-11e7-9c56-68f728c1ba70
  x-audience: external-partner
  termsOfService: http://abc.com/terms/
  contact:
    name: API Support
    url: http://www.abc.com/support
    email: support@abc.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.abc.com/fs/v1
    description: Production Server
paths:
  /audienceCategoryGroups:
    get:
      operationId: getAllAudienceCategoryGroup
      tags:
        - Audience Category Group
      summary: Get All Audience Category Group
      description: Returns list of Audience Category Group
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: query
          name: pageNo
          schema:
            type: integer
            default: 0
          description: The requested page number
        - in: query
          name: pageSize
          schema:
            type: integer
            default: 10
          description: Number of items in the returned page
        - in: query
          name: sortBy
          schema:
            type: string
            default: id
          description: Sorted by field
        - in: query
          name: sortDir
          schema:
            type: string
            default: asc
            enum:
              - asc
              - desc
          description: |
            Sort order:
             * `asc` - Ascending, from A to Z
             * `desc` - Descending, from Z to A
        - in: query
          name: search
          schema:
            type: string
            default: null
          description: >
            Available search fields:
             * `name`  - It takes String value.
             * `audience_category_group_uuid`  - It takes String value.
             * `update_stamp`  - It takes Integer value. <br>
            For further RSQL query options, please visit https://github.com/jirutka/rsql-parser#examples
      security:
        - bearerAuth:
            - uid
      responses:
        "200":
          description: Returns requested List of Audience Category Group
          headers:
            TOTAL-PAGE:
              schema:
                type: integer
              description: Total Number of Available Pages
            SORT-BY:
              schema:
                type: string
              description: Sorted by field
            SORT-DIR:
              schema:
                type: string
                default: asc
                enum:
                  - asc
                  - desc
              description: Sort Order
            TOTAL-ELEMENTS-IN-CURRENT-PAGE:
              schema:
                type: integer
              description: Total number of elements returned in the current page
            PAGE-SIZE:
              schema:
                type: integer
              description: Number of elements in a page
            CURRENT-PAGE:
              schema:
                type: integer
              description: The current page index
            TOTAL-ELEMENTS:
              schema:
                type: integer
              description: The total number of available elements
          content:
            application/json:
              schema:
                type: object
                properties:
                  audience_category_group_list:
                    type: array
                    items:
                      $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D/get\
                        /responses/200/content/application~1json/schema"
                    description: List of the AudienceCategoryGroup
  "/audienceCategoryGroups/{audience-category-group-uuid}/audienceCategories":
    get:
      operationId: getAllAudienceCategoriesByGroup
      tags:
        - Audience Category Group
      summary: Get All Audience Category Under a Group
      description: Returns list of Audience Category Under a Group
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-group-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category Group
        - in: query
          name: pageNo
          schema:
            type: integer
            default: 0
          description: The requested page number
        - in: query
          name: pageSize
          schema:
            type: integer
            default: 10
          description: Number of items in the returned page
        - in: query
          name: sortBy
          schema:
            type: string
            default: id
          description: Sorted by field
        - in: query
          name: sortDir
          schema:
            type: string
            default: asc
            enum:
              - asc
              - desc
          description: |
            Sort order:
             * `asc` - Ascending, from A to Z
             * `desc` - Descending, from Z to A
        - in: query
          name: search
          schema:
            type: string
            default: null
          description: >
            Available search fields:
             * `name`  - It takes String value
             * `audience_category_uuid`  - It takes String value
             * `description` - It takes String value
             * `update_stamp`  - It takes Integer value <br>
            For further RSQL query options, please visit https://github.com/jirutka/rsql-parser#examples
      security:
        - bearerAuth:
            - uid
      responses:
        "200":
          description: Returns requested List of Audience Category Group
          headers:
            TOTAL-PAGE:
              schema:
                type: integer
              description: Total Number of Available Pages
            SORT-BY:
              schema:
                type: string
              description: Sorted by field
            SORT-DIR:
              schema:
                type: string
                default: asc
                enum:
                  - asc
                  - desc
              description: Sort Order
            TOTAL-ELEMENTS-IN-CURRENT-PAGE:
              schema:
                type: integer
              description: Total number of elements returned in the current page
            PAGE-SIZE:
              schema:
                type: integer
              description: Number of elements in a page
            CURRENT-PAGE:
              schema:
                type: integer
              description: The current page index
            TOTAL-ELEMENTS:
              schema:
                type: integer
              description: The total number of available elements
          content:
            application/json:
              schema:
                type: object
                properties:
                  audience_category_list:
                    type: array
                    items:
                      $ref: "#/paths/~1audienceCategories~1%7Baudience-category-uuid%7D/get/responses\
                        /200/content/application~1json/schema"
                    description: List of the AudienceCategory
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - error_type
                  - message
                properties:
                  code:
                    type: integer
                    format: int32
                  error_type:
                    type: string
                    enum:
                      - DEFAULT
                      - MISSING_ENVIRONMENT_ID
                      - INVALID_ENVIRONMENT_ID
                      - INVALID_REFERENCED_OBJECT
                      - INVALID_REQUEST_INPUT
                      - INVALID_PATH_VARIABLE
                      - DEFAULT_OBJECT_MANIPULATION_NOT_ALLOWED
                      - INVALID_REQUEST_PARAM
                      - INVALID_PARENT_REFERENCE
                  message:
                    type: string
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-group-uuid must be between 1 and 50
  "/audienceCategoryGroups/{audience-category-group-uuid}":
    get:
      operationId: getAudienceCategoryGroupByUUID
      tags:
        - Audience Category Group
      summary: Get Audience Category Group by audience-category-group-uuid
      description: Returns the Audience Category Group
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-group-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category Group
      security:
        - bearerAuth:
            - uid
      responses:
        "200":
          description: Returns requested Audience Category Group
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 100
                        description: Name of the Audience Category Group
                  - properties:
                      audience_category_group_uuid:
                        type: string
                        minLength: 1
                        maxLength: 50
                        description: Market Universal ID of the Audience Category Group
                      update_stamp:
                        type: integer
                        format: int64
                        description: Last update stamp of Audience Category
                  - type: object
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-group-uuid must be between 1 and 50
        "404":
          description: Not Found, if the specified Audience Category Group could not be
            found in the system
    put:
      operationId: createOrUpdateAudienceCategoryGroupByUUID
      tags:
        - Audience Category Group
      summary: Create Or Update Audience Category Group
      description: Create Or Update Audience Category Group
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-group-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category Group
      security:
        - bearerAuth:
            - uid
      requestBody:
        description: Audience Category Group
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D/get\
                    /responses/200/content/application~1json/schema/allOf/0"
                - type: object
                  required:
                    - name
            example:
              name: Males Only
      responses:
        "201":
          description: Created if the Audience Category Group not existing before and
            created successfully
        "204":
          description: No Content if the Audience Category Group existing before and
            created successfully
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-group-uuid must be between 1 and 50
    patch:
      operationId: partialUpdateAudienceCategoryGroupByUUID
      tags:
        - Audience Category Group
      summary: Partial Update Audience Category Group
      description: Partial Update Audience Category Group
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-group-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category Group
      security:
        - bearerAuth:
            - uid
      requestBody:
        description: Audience Category Group
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D/get\
                    /responses/200/content/application~1json/schema/allOf/0"
                - type: object
      responses:
        "204":
          description: No Content if the Audience Category Group updated successfully
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-group-uuid must be between 1 and 50
        "404":
          description: Not Found, if the specified Audience Category Group could not be
            found in the system
    delete:
      operationId: deleteAudienceCategoryGroupByUUID
      tags:
        - Audience Category Group
      summary: Delete Audience Category Group by audience-category-group-uuid
      description: Sets the Audience Category Group to be inactive
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-group-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category Group
      security:
        - bearerAuth:
            - uid
      responses:
        "204":
          description: No Content if the Audience Category Group deleted successfully
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-group-uuid must be between 1 and 50
        "404":
          description: Not Found, if the specified Audience Category Group could not be
            found in the system
  /audienceCategories:
    get:
      operationId: getAllAudienceCategory
      tags:
        - Audience Category
      summary: Get All Audience Category
      description: Returns list of Audience Category
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: query
          name: pageNo
          schema:
            type: integer
            default: 0
          description: The requested page number
        - in: query
          name: pageSize
          schema:
            type: integer
            default: 10
          description: Number of items in the returned page
        - in: query
          name: sortBy
          schema:
            type: string
            default: id
          description: Sorted by field
        - in: query
          name: sortDir
          schema:
            type: string
            default: asc
            enum:
              - asc
              - desc
          description: |
            Sort order:
             * `asc` - Ascending, from A to Z
             * `desc` - Descending, from Z to A
        - in: query
          name: search
          schema:
            type: string
            default: null
          description: >
            Available search fields:
             * `name`  - It takes String value.
             * `audience_category_uuid`  - It takes String value.
             * `description` - It takes String value.
             * `update_stamp`  - It takes Integer value. <br>
            For further RSQL query options, please visit https://github.com/jirutka/rsql-parser#examples
      security:
        - bearerAuth:
            - uid
      responses:
        "200":
          description: Returns requested List of Audience Category
          headers:
            TOTAL-PAGE:
              schema:
                type: integer
              description: Total Number of Available Pages
            SORT-BY:
              schema:
                type: string
              description: Sorted by field
            SORT-DIR:
              schema:
                type: string
                default: asc
                enum:
                  - asc
                  - desc
              description: Sort Order
            TOTAL-ELEMENTS-IN-CURRENT-PAGE:
              schema:
                type: integer
              description: Total number of elements returned in the current page
            PAGE-SIZE:
              schema:
                type: integer
              description: Number of elements in a page
            CURRENT-PAGE:
              schema:
                type: integer
              description: The current page index
            TOTAL-ELEMENTS:
              schema:
                type: integer
              description: The total number of available elements
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/200/content/application~1json/\
                  schema"
  "/audienceCategories/{audience-category-uuid}":
    get:
      operationId: getAudienceCategoryByUUID
      tags:
        - Audience Category
      summary: Get Audience Category by audience-group-uuid
      description: Returns the Audience Category
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category
      security:
        - bearerAuth:
            - uid
      responses:
        "200":
          description: Returns requested Audience Category
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 100
                        description: Name of the Audience Category
                      description:
                        type: string
                        minLength: 0
                        maxLength: 255
                        description: Description of the Audience Category
                      audience_category_group_uuid:
                        type: string
                        minLength: 1
                        maxLength: 50
                        description: Market Universal ID of the Audience Category Group
                      parent_audience_category_uuid:
                        type: string
                        minLength: 1
                        maxLength: 50
                        description: Market Universal ID of the Parent Audience Category
                    example:
                      audience_category_group_uuid: Males
                      name: Males Between 20 and 40
                      description: Audience Category of the males between age of 20 and 40
                  - properties:
                      audience_category_uuid:
                        type: string
                        minLength: 1
                        maxLength: 50
                        description: Market Universal ID of the Audience Category
                      update_stamp:
                        type: integer
                        format: int64
                        description: Last update stamp of Audience Category
                  - type: object
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-uuid must be between 1 and 50
        "404":
          description: Not Found, if the specified Audience Category could not be found in
            the system
    put:
      operationId: createOrUpdateAudienceCategoryByUUID
      tags:
        - Audience Category
      summary: Create Or Update Audience Category
      description: Create Or Update Audience Category
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category
      security:
        - bearerAuth:
            - uid
      requestBody:
        description: Audience Category
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/paths/~1audienceCategories~1%7Baudience-category-uuid%7D/get/responses\
                    /200/content/application~1json/schema/allOf/0"
                - type: object
                  required:
                    - name
                    - audience_category_group_uuid
      responses:
        "201":
          description: Created if the Audience Category not existing before and created
            successfully
        "204":
          description: No Content if the Audience Category existing before and created
            successfully
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-uuid must be between 1 and 50
    patch:
      operationId: partialUpdateAudienceCategoryByUUID
      tags:
        - Audience Category
      summary: Partial Update Audience Category
      description: Partial Update Audience Category
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category
      security:
        - bearerAuth:
            - uid
      requestBody:
        description: Audience Category
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/paths/~1audienceCategories~1%7Baudience-category-uuid%7D/get/responses\
                    /200/content/application~1json/schema/allOf/0"
                - type: object
      responses:
        "204":
          description: No Content if the Audience Category updated successfully
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-uuid must be between 1 and 50
        "404":
          description: Not Found, if the specified Audience Category could not be found in
            the system
    delete:
      operationId: deleteAudienceCategoryByUUID
      tags:
        - Audience Category
      summary: Delete Audience Category by audience-category-uuid
      description: Sets the Audience Category to be inactive
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Category
      security:
        - bearerAuth:
            - uid
      responses:
        "204":
          description: No Content if the Audience Category deleted successfully
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-uuid must be between 1 and 50
        "404":
          description: Not Found, if the specified Audience Category could not be found in
            the system
  "/audienceCategories/{audience-category-uuid}/channels":
    get:
      operationId: getAllChannelsByAudienceCategorie
      tags:
        - Audience Category
      summary: Get All Channel Under a Audience Categorie
      description: Returns list of Channel Under a Audience Categorie
      parameters:
        - in: header
          name: env-id
          schema:
            type: string
          required: true
          description: Market Universal ID of the Tenant
        - in: path
          name: audience-category-uuid
          schema:
            type: string
            minLength: 1
            maxLength: 50
          required: true
          description: Market Universal ID of the Audience Categorie
        - in: query
          name: pageNo
          schema:
            type: integer
            default: 0
          description: The requested page number
        - in: query
          name: pageSize
          schema:
            type: integer
            default: 10
          description: Number of items in the returned page
        - in: query
          name: sortBy
          schema:
            type: string
            default: id
          description: Sorted by field
        - in: query
          name: sortDir
          schema:
            type: string
            default: asc
            enum:
              - asc
              - desc
          description: |
            Sort order:
             * `asc` - Ascending, from A to Z
             * `desc` - Descending, from Z to A
        - in: query
          name: search
          schema:
            type: string
            default: null
          description: >
            Available search fields:
             * `name`  - It takes String value.
             * `audience_category_uuid`  - It takes String value.
             * `day_part_group_uuid` - It takes String value.
             * `channel_uuid` - It takes String value.
             * `update_stamp`  - It takes Integer value. <br>
            For further RSQL query options, please visit https://github.com/jirutka/rsql-parser#examples
      security:
        - bearerAuth:
            - uid
      responses:
        "200":
          description: Returns requested List of Channel
          headers:
            TOTAL-PAGE:
              schema:
                type: integer
              description: Total Number of Available Pages
            SORT-BY:
              schema:
                type: string
              description: Sorted by field
            SORT-DIR:
              schema:
                type: string
                default: asc
                enum:
                  - asc
                  - desc
              description: Sort Order
            TOTAL-ELEMENTS-IN-CURRENT-PAGE:
              schema:
                type: integer
              description: Total number of elements returned in the current page
            PAGE-SIZE:
              schema:
                type: integer
              description: Number of elements in a page
            CURRENT-PAGE:
              schema:
                type: integer
              description: The current page index
            TOTAL-ELEMENTS:
              schema:
                type: integer
              description: The total number of available elements
        "400":
          description: Bad Request, if the request not proper
          content:
            application/json:
              schema:
                $ref: "#/paths/~1audienceCategoryGroups~1%7Baudience-category-group-uuid%7D~1au\
                  dienceCategories/get/responses/400/content/application~1json/\
                  schema"
              example:
                code: 2300
                error_type: INVALID_PATH_VARIABLE
                message: audience-category-uuid must be between 1 and 50  
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
Generation Details

java -jar openapi-generator-cli-7.6.0.jar generate -i Z:\imgs\abc.yaml -g csharp -o Z:\imgs\abc_openapi_yaml --additional-properties library=httpclient --additional-properties targetFramework=net8.0

Suggest a fix

requestBody: description: Audience Category required: true content: application/json: schema: allOf:

It lookup the requestBody, but cannot find the definition.

hesi726 commented 3 months ago

https://github.com/OpenAPITools/openapi-generator/issues/18429

It should be the same problem, but i have used the latest jar openapi-generator-cli-7.7.0-20240612.160442-81.jar.

wing328 commented 3 months ago
      requestBody:
        description: Audience Category
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/paths/~1audienceCategories~1%7Baudience-category-uuid%7D/get/responses\
                    /200/content/application~1json/schema/allOf/0"
                - type: object
                  required:
                    - name
                    - audience_category_group_uuid

looks like the first $ref in allOf is referencing something that it's not defined.