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