Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !730

[cpp pistache] fix leading number in model names and apply modelNamePrefix in all cases

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/etherealjoy/cpp_pistache_fix_leading_number into master Aug 03, 2018
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 7

Created by: etherealjoy

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

  • Allow prefixing API Names and Model Names and their files, this allow usage of conflicting model names from different specs or to prevent a number in a class name and file name.
  • escape nameInCamelCase for variables with a leading number.
  • default prefix is empty string no change in current behaviour
  • other c++ petstore sample code remains unchanged.
  • Same behaviour as Qt5 client/server

usage example

java -jar ~/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar  \
generate -g cpp-pistache-server -i ~/test/swagger.yaml -o ~/gennew  \
--additional-properties modelNamePrefix=TET

With this sample spec

openapi: 3.0.0
info:
  version: 1.0.0
  title: Check 5gmmCapability
servers:
  - url: 'http://localhost:8080'
  
paths:
  /Check5gmmCapability:
    get:
      summary: Check property beginning with a number
      operationId: list
      tags:
        - Check
      responses:
        '200':
          description: Everythings gonna be alright
          headers:
            x-next:
              description: A link to the next page of responses
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Content'
components:
  schemas:
    5gmmCapability:
      type: object
      properties:
        item1:
          type: string
        item2:
          type: integer
        5gItem:
          type: integer
    Content:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/5gmmCapability'

we have something like this

class TET5gmmCapability --> File name model\TET5gmmCapability.h class TETCheckApiImpl --> File name impl\TETCheckApiImpl.h class TETCheckApi --> File name api\TETCheckApi.h class TETModelBase --> File name model\TETModelBase.h main --> File name TETCheckApiMainServer.cpp

Fixes #604 (closed)

@stkrwork @MartinDelille @fvarose @ravinikam

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/etherealjoy/cpp_pistache_fix_leading_number