OpenAPITools / OpenAPITools/openapi-generator

[BUG] vendorExtensions x-go-custom-tag does not work

Open
#8,818 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?

  • Have you validated the input using an OpenAPI validator (example)?

  • Have you tested with the latest master to confirm the issue still exists?

  • Have you searched for related issues/PRs?

  • What's the actual output vs expected output?

generate the golang server code, with --global-property debugModels=true
"vendorExtensions" : {xxxx },
but shows:
"vendorExtensions" : { },

I had set the vendorExtensions x-go-custom-tag: 'gorm:"primary_key"' in many part include info part. But not work.

Did I did something wrong or how to add custom tag for golang while generating client/server code?

  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

vendorExtensions x-go-custom-tag does not work

openapi-generator version

5.0.1-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.0

info:
  title: Nucmf_UECapabilityManagement
  version: 1.0.2
  
  description: |
    Nucmf_UECapabilityManagement Service.
    © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).
    All rights reserved.
  x-go-custom-tag: 'gorm:"primary_key"'


externalDocs:
  description: 3GPP TS 29.673 V16.3.0; 5G System; UE Radio Capability Management Services
  url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.673/

servers:
  - url: '{apiRoot}/nucmf-uecm/v1'
    variables:
      apiRoot:
        default: https://example.com
        description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501

security:
  - {}
  - oAuth2ClientCredentials:
    - nucmf-uecm

paths:
  /dic-entries:
    get:
      summary: retrieve a dictionary entry matching query parameters
      operationId: RetrieveDictionaryEntry
      tags:
        - Dictionary Entry (Store)
      parameters:
        - name: ue-radio-capa-id
          in: query
          required: true
          description: UE Radio Capability ID, either PLMN Assigned or Manufacturer Assigned
          schema:
            $ref: '#/components/schemas/UeRadioCapaId'
        - name: rac-format
          in: query
          description: Encoding format of RAC Info
          schema:
            $ref: '#/components/schemas/RacFormat'
      responses:
        '200':
          description: Expected response to a valid request
          content:
            multipart/related:  # message with binary body part(s)
              schema:
                type: object
                properties: # Request parts
                  jsonData:
                    $ref: '#/components/schemas/DicEntryData'
                  binaryDataUeRadioCapability5GS:
                    type: string
                    format: binary
                  binaryDataUeRadioCapabilityEPS:
                    type: string
                    format: binary
              encoding:
                jsonData:
                  contentType:  application/json
                binaryDataUeRadioCapability5GS:
                  contentType:  application/vnd.3gpp.ngap
                  headers:
                    Content-Id:
                      schema:
                        type: string
                binaryDataUeRadioCapabilityEPS:
                  contentType:  application/vnd.3gpp.s1ap
                  headers:
                    Content-Id:
                      schema:
                        type: string
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29571_CommonData.yaml#/components/responses/406'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '501':
          $ref: 'TS29571_CommonData.yaml#/components/responses/501'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

    post:
      summary: Create a dictionary entry in the UCMF
      tags:
        - a dictionary entry (Document)
      operationId: CreateDictionaryEntry
      requestBody:
        content:
          multipart/related:  # message with binary body part(s)
            schema:
              type: object
              properties: # Request parts
                jsonData:
                  $ref: '#/components/schemas/DicEntryCreateData'
                binaryDataUeRadioCapability5GS:
                  type: string
                  format: binary
                binaryDataUeRadioCapabilityEPS:
                  type: string
                  format: binary
           
            encoding:
              jsonData:
                contentType:  application/json
              binaryDataUeRadioCapability5GS:
                contentType:  application/vnd.3gpp.ngap
                headers:
                  Content-Id:
                    schema:
                      type: string
              binaryDataUeRadioCapabilityEPS:
                contentType:  application/vnd.3gpp.s1ap
                headers:
                  Content-Id:
                    schema:
                      type: string
        required: true
      responses:
        '201':
          description: Dictionary Created
          headers:
            Location:
              description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nucmf-uecm/<apiVersion>/dic-entries/{dicEntryId}'
              required: true
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DicEntryCreatedData'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '501':
          $ref: 'TS29571_CommonData.yaml#/components/responses/501'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'

  /dic-entries/{dicEntryId}:
    get:
      summary: Get an individual dictionary entry via dicEntryId
      operationId: GetDicEntry
      tags:
        - dic Entry Id (Document)
      parameters:
        - name: dicEntryId
          in: path
          description: the ID of a dictionary entry in the UCMF
          required: true
          schema:
            $ref: '#/components/schemas/DicEntryId'
        - name: rac-format
          in: query
          description: Encoding format of of RAC Info
          schema:
            $ref: '#/components/schemas/RacFormat'
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DicEntryData'
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '406':
          $ref: 'TS29571_CommonData.yaml#/components/responses/406'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '501':
          $ref: 'TS29571_CommonData.yaml#/components/responses/501'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'


  /subscriptions:
    post:
      summary: Nucmf_UECapabilityManagement Subscribe service Operation
      operationId: CreateIndividualSubcription
      tags:
        - Subscriptions (Collection)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscription'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedSubscription'
          headers:
            Location:
              description: 'Contains the URI of the newly created resource, according to the structure: {apiRoot}/nucmf-uecm/<apiVersion>/subscriptions/{subscriptionId}'
              required: true
              schema:
                type: string
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '411':
          $ref: 'TS29571_CommonData.yaml#/components/responses/411'
        '413':
          $ref: 'TS29571_CommonData.yaml#/components/responses/413'
        '415':
          $ref: 'TS29571_CommonData.yaml#/components/responses/415'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'
      callbacks:
        myNotification:
          '{$request.body#/ucmfNotificationUri}':
            post:
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/UcmfNotification'
              responses:
                '204':
                  description: No Content, Notification was succesfull
                '400':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/400'
                '401':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/401'
                '403':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/403'
                '404':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/404'
                '411':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/411'
                '413':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/413'
                '415':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/415'
                '429':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/429'
                '500':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/500'
                '503':
                  $ref: 'TS29571_CommonData.yaml#/components/responses/503'
                default:
                  $ref: 'TS29571_CommonData.yaml#/components/responses/default'

  /subscriptions/{subscriptionId}:
    delete:
      summary: unsubscribe from notifications
      operationId: DeleteIndividualSubcription
      tags:
        - IndividualSubscription (Document)
      parameters:
        - name: subscriptionId
          in: path
          description: Event Subscription ID
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No Content. Resource was succesfully deleted
        '400':
          $ref: 'TS29571_CommonData.yaml#/components/responses/400'
        '401':
          $ref: 'TS29571_CommonData.yaml#/components/responses/401'
        '403':
          $ref: 'TS29571_CommonData.yaml#/components/responses/403'
        '404':
          $ref: 'TS29571_CommonData.yaml#/components/responses/404'
        '429':
          $ref: 'TS29571_CommonData.yaml#/components/responses/429'
        '500':
          $ref: 'TS29571_CommonData.yaml#/components/responses/500'
        '503':
          $ref: 'TS29571_CommonData.yaml#/components/responses/503'
        default:
          $ref: 'TS29571_CommonData.yaml#/components/responses/default'


components:
  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: '{nrfApiRoot}/oauth2/token'
          scopes:
            nucmf-uecm: Access to the Nucmf_UECapabilityManagement API

  schemas:
    DicEntryData:
      type: object
      required:
        - typeAllocationCode
      properties:
        dicEntryId:
          $ref: '#/components/schemas/DicEntryId'
        
        typeAllocationCode:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/TypeAllocationCode'
        plmnAssiUeRadioCapId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnAssiUeRadioCapId'
        manAssiUeRadioCapId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/ManAssiUeRadioCapId'
        ueRadioCapability5GS:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData'
        ueRadioCapabilityEPS:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData'

    DicEntryCreateData:
      type: object
      required:
        - typeAllocationCode
      properties:
        typeAllocationCode:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/TypeAllocationCode'
        ueRadioCapability5GS:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData'
        ueRadioCapabilityEPS:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/RefToBinaryData'

    DicEntryCreatedData:
      type: object
      required:
        - plmnAssiUeRadioCapId
      properties:
        plmnAssiUeRadioCapId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnAssiUeRadioCapId'


    UeRadioCapaId:
      type: object
      properties:
        plmnAssiUeRadioCapId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnAssiUeRadioCapId'
        manAssiUeRadioCapId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/ManAssiUeRadioCapId'
    


    CreateSubscription:
      type: object
      required:
        - ucmfNotificationUri
      properties:
        nfId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId'
        ucmfNotificationUri:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
        suggestedExpires:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'

    CreatedSubscription:
      type: object
      required:
        - dicEntryId
      properties:
        dicEntryId:
          $ref: '#/components/schemas/DicEntryId'
        confirmedExpires:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/DateTime'

    UcmfNotification:
      type: object
      required:
        - dicEntryId
        - eventType
      properties:
        dicEntryId:
          $ref: '#/components/schemas/DicEntryId'
        eventType:
          $ref: '#/components/schemas/EventType'
        manAssOpRequestlist:
          $ref: '#/components/schemas/manAssOpRequestlist'
          minItems: 1
        versionId:
          $ref: 'TS29571_CommonData.yaml#/components/schemas/Uinteger'

    manAssOpRequestlist:
      type: object
      oneOf:
        - required: [plmnAssiUeRadioCapId]
        - required: [typeAllocationCod]
      properties:
        plmnAssiUeRadioCapId:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnAssiUeRadioCapId'
          minItems: 1
        typeAllocationCode:
          type: array
          items:
            $ref: 'TS29571_CommonData.yaml#/components/schemas/TypeAllocationCode'


#
# SIMPLE DATA TYPES
#
    DicEntryId:
      type: integer
      minimum: 0
      maximum: 4294967295

#
# ENUMERATIONS
#

    EventType:
      anyOf:
      - type: string
        enum:
          - CREATION_OF_DICTIONARY_ENTRY
          - DELETION_OF_PLMN_ASSIGNED_IDS
          - NEW_VERSION_ID_OF_PLMN_ASSIGNED_IDs
      - type: string

    RacFormat:
      anyOf:
      - type: string
        enum:
          - 5GS
          - EPS
      - type: string

Generation Details

max@max-Virtual-Machine:~/opanapi/openapi-generator$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g go-server -o out -i schema/TS29673_Nucmf_UERCM_102.yaml --global-property debugModels=true

in the debug mode output, "vendorExtensions" : { } should contain something, but there is no.

...
   "parentVars" : [ ],
    "mandatory" : [ ],
    "allMandatory" : [ ],
    "imports" : [ ],
    "hasVars" : true,
    "emptyVars" : false,
    "hasMoreModels" : false,
    "hasEnums" : false,
    "isEnum" : false,
    "hasValidation" : false,
    "isNullable" : false,
    "hasRequired" : false,
    "hasOptional" : true,
    "isArray" : false,
    "hasChildren" : false,
    "isMap" : false,
    "isNull" : false,
    "isDeprecated" : false,
    "hasOnlyReadOnly" : false,
    "vendorExtensions" : { },
    "isAdditionalPropertiesTrue" : false,
    "uniqueItems" : false,
    "exclusiveMinimum" : false,
    "exclusiveMaximum" : false,
    "isModel" : false,
    "isClassnameSanitized" : false
  }
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing Go server generation with the supplied OpenAPI document and --global-property debugModels=true, then trace how the info-level x-go-custom-tag extension is handled; done means the reported vendor extension behavior is corrected and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.