diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index 775afb9bd59..095d6ac7e18 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -48,7 +48,7 @@ import static org.openapitools.codegen.utils.StringUtils.underscore; public class ElixirClientCodegen extends DefaultCodegen { private final Logger LOGGER = LoggerFactory.getLogger(ElixirClientCodegen.class); - private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_@\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-)\\z"); + private final Pattern simpleAtomPattern = Pattern.compile("\\A(?:(?:[_\\p{Alpha}][_@\\p{Alnum}]*[?!]?)|-|@)\\z"); @Setter protected String packageVersion = "1.0.0"; @Setter protected String moduleName; diff --git a/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml index e4957b4e19d..229450a390d 100644 --- a/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/elixir/petstore-with-fake-endpoints-models-for-testing.yaml @@ -8,7 +8,7 @@ info: title: OpenAPI Petstore license: name: Apache-2.0 - url: 'https://www.apache.org/licenses/LICENSE-2.0.html' + url: "https://www.apache.org/licenses/LICENSE-2.0.html" tags: - name: pet description: Everything about your Pets @@ -28,65 +28,65 @@ paths: type: object properties: string: - $ref: '#/components/schemas/Foo' + $ref: "#/components/schemas/Foo" /pet: servers: - - url: 'http://petstore.swagger.io/v2' - - url: 'http://path-server-test.petstore.local/v2' - - url: 'http://{server}.swagger.io:{port}/v2' - description: test server with variables - variables: - server: - description: target server - enum: - - 'petstore' - - 'qa-petstore' - - 'dev-petstore' - default: 'petstore' - port: - enum: - - 80 - - 8080 - default: 80 + - url: "http://petstore.swagger.io/v2" + - url: "http://path-server-test.petstore.local/v2" + - url: "http://{server}.swagger.io:{port}/v2" + description: test server with variables + variables: + server: + description: target server + enum: + - "petstore" + - "qa-petstore" + - "dev-petstore" + default: "petstore" + port: + enum: + - 80 + - 8080 + default: 80 post: tags: - pet summary: Add a new pet to the store - description: '' + description: "" operationId: addPet responses: - '200': + "200": description: Successful operation - '405': + "405": description: Invalid input security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" requestBody: - $ref: '#/components/requestBodies/Pet' + $ref: "#/components/requestBodies/Pet" put: tags: - pet summary: Update an existing pet - description: '' + description: "" operationId: updatePet x-webclient-blocking: true responses: - '200': + "200": description: Successful operation - '400': + "400": description: Invalid ID supplied - '404': + "404": description: Pet not found - '405': + "405": description: Validation exception security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" requestBody: - $ref: '#/components/requestBodies/Pet' + $ref: "#/components/requestBodies/Pet" /pet/findByStatus: get: tags: @@ -113,25 +113,25 @@ paths: - sold default: available responses: - '200': + "200": description: successful operation content: application/xml: schema: type: array items: - $ref: '#/components/schemas/Pet' + $ref: "#/components/schemas/Pet" application/json: schema: type: array items: - $ref: '#/components/schemas/Pet' - '400': + $ref: "#/components/schemas/Pet" + "400": description: Invalid status value security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" /pet/findByTags: get: tags: @@ -155,29 +155,29 @@ paths: type: string uniqueItems: true responses: - '200': + "200": description: successful operation content: application/xml: schema: type: array items: - $ref: '#/components/schemas/Pet' + $ref: "#/components/schemas/Pet" uniqueItems: true application/json: schema: type: array items: - $ref: '#/components/schemas/Pet' + $ref: "#/components/schemas/Pet" uniqueItems: true - '400': + "400": description: Invalid tag value security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" deprecated: true - '/pet/{petId}': + "/pet/{petId}": get: tags: - pet @@ -194,18 +194,18 @@ paths: type: integer format: int64 responses: - '200': + "200": description: successful operation content: application/xml: schema: - $ref: '#/components/schemas/Pet' + $ref: "#/components/schemas/Pet" application/json: schema: - $ref: '#/components/schemas/Pet' - '400': + $ref: "#/components/schemas/Pet" + "400": description: Invalid ID supplied - '404': + "404": description: Pet not found security: - api_key: [] @@ -213,7 +213,7 @@ paths: tags: - pet summary: Updates a pet in the store with form data - description: '' + description: "" operationId: updatePetWithForm parameters: - name: petId @@ -224,14 +224,14 @@ paths: type: integer format: int64 responses: - '200': + "200": description: Successful operation - '405': + "405": description: Invalid input security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" requestBody: content: application/x-www-form-urlencoded: @@ -248,7 +248,7 @@ paths: tags: - pet summary: Deletes a pet - description: '' + description: "" operationId: deletePet parameters: - name: api_key @@ -264,20 +264,20 @@ paths: type: integer format: int64 responses: - '200': + "200": description: Successful operation - '400': + "400": description: Invalid pet value security: - petstore_auth: - - 'write:pets' - - 'read:pets' - '/pet/{petId}/uploadImage': + - "write:pets" + - "read:pets" + "/pet/{petId}/uploadImage": post: tags: - pet summary: uploads an image - description: '' + description: "" operationId: uploadFile parameters: - name: petId @@ -288,16 +288,16 @@ paths: type: integer format: int64 responses: - '200': + "200": description: successful operation content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: "#/components/schemas/ApiResponse" security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" requestBody: content: multipart/form-data: @@ -320,7 +320,7 @@ paths: operationId: getInventory x-webclient-blocking: false responses: - '200': + "200": description: successful operation content: application/json: @@ -336,28 +336,28 @@ paths: tags: - store summary: Place an order for a pet - description: '' + description: "" operationId: placeOrder responses: - '200': + "200": description: successful operation content: application/xml: schema: - $ref: '#/components/schemas/Order' + $ref: "#/components/schemas/Order" application/json: schema: - $ref: '#/components/schemas/Order' - '400': + $ref: "#/components/schemas/Order" + "400": description: Invalid Order requestBody: content: application/json: schema: - $ref: '#/components/schemas/Order' + $ref: "#/components/schemas/Order" description: order placed for purchasing the pet required: true - '/store/order/{order_id}': + "/store/order/{order_id}": get: tags: - store @@ -377,18 +377,18 @@ paths: minimum: 1 maximum: 5 responses: - '200': + "200": description: successful operation content: application/xml: schema: - $ref: '#/components/schemas/Order' + $ref: "#/components/schemas/Order" application/json: schema: - $ref: '#/components/schemas/Order' - '400': + $ref: "#/components/schemas/Order" + "400": description: Invalid ID supplied - '404': + "404": description: Order not found delete: tags: @@ -406,9 +406,9 @@ paths: schema: type: string responses: - '400': + "400": description: Invalid ID supplied - '404': + "404": description: Order not found /user: post: @@ -424,7 +424,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/User' + $ref: "#/components/schemas/User" description: Created user object required: true /user/createWithArray: @@ -432,31 +432,31 @@ paths: tags: - user summary: Creates list of users with given input array - description: '' + description: "" operationId: createUsersWithArrayInput responses: default: description: successful operation requestBody: - $ref: '#/components/requestBodies/UserArray' + $ref: "#/components/requestBodies/UserArray" /user/createWithList: post: tags: - user summary: Creates list of users with given input array - description: '' + description: "" operationId: createUsersWithListInput responses: default: description: successful operation requestBody: - $ref: '#/components/requestBodies/UserArray' + $ref: "#/components/requestBodies/UserArray" /user/login: get: tags: - user summary: Logs user into the system - description: '' + description: "" operationId: loginUser parameters: - name: username @@ -472,7 +472,7 @@ paths: schema: type: string responses: - '200': + "200": description: successful operation headers: X-Rate-Limit: @@ -492,24 +492,24 @@ paths: application/json: schema: type: string - '400': + "400": description: Invalid username/password supplied /user/logout: get: tags: - user summary: Logs out current logged in user session - description: '' + description: "" operationId: logoutUser responses: default: description: successful operation - '/user/{username}': + "/user/{username}": get: tags: - user summary: Get user by user name - description: '' + description: "" operationId: getUserByName parameters: - name: username @@ -519,18 +519,18 @@ paths: schema: type: string responses: - '200': + "200": description: successful operation content: application/xml: schema: - $ref: '#/components/schemas/User' + $ref: "#/components/schemas/User" application/json: schema: - $ref: '#/components/schemas/User' - '400': + $ref: "#/components/schemas/User" + "400": description: Invalid username supplied - '404': + "404": description: User not found put: tags: @@ -546,15 +546,15 @@ paths: schema: type: string responses: - '400': + "400": description: Invalid user supplied - '404': + "404": description: User not found requestBody: content: application/json: schema: - $ref: '#/components/schemas/User' + $ref: "#/components/schemas/User" description: Updated user object required: true delete: @@ -571,28 +571,28 @@ paths: schema: type: string responses: - '400': + "400": description: Invalid username supplied - '404': + "404": description: User not found /fake_classname_test: patch: tags: - - 'fake_classname_tags 123#$%^' + - "fake_classname_tags 123#$%^" summary: To test class name in snake case description: To test class name in snake case operationId: testClassname responses: - '200': + "200": description: successful operation content: application/json: schema: - $ref: '#/components/schemas/Client' + $ref: "#/components/schemas/Client" security: - api_key_query: [] requestBody: - $ref: '#/components/requestBodies/Client' + $ref: "#/components/requestBodies/Client" /fake: patch: tags: @@ -601,14 +601,14 @@ paths: description: To test "client" model operationId: testClientModel responses: - '200': + "200": description: successful operation content: application/json: schema: - $ref: '#/components/schemas/Client' + $ref: "#/components/schemas/Client" requestBody: - $ref: '#/components/requestBodies/Client' + $ref: "#/components/requestBodies/Client" get: tags: - fake @@ -625,7 +625,7 @@ paths: type: string default: $ enum: - - '>' + - ">" - $ - name: enum_header_string in: header @@ -634,9 +634,9 @@ paths: type: string enum: - _abc - - '-efg' + - "-efg" - (xyz) - default: '-efg' + default: "-efg" - name: enum_query_string_array in: query description: Query parameter enum test (string array) @@ -646,7 +646,7 @@ paths: type: string default: $ enum: - - '>' + - ">" - $ - name: enum_query_string in: query @@ -655,9 +655,9 @@ paths: type: string enum: - _abc - - '-efg' + - "-efg" - (xyz) - default: '-efg' + default: "-efg" - name: enum_query_integer in: query description: Query parameter enum test (double) @@ -681,11 +681,11 @@ paths: schema: type: array items: - $ref: '#/components/schemas/EnumClass' + $ref: "#/components/schemas/EnumClass" responses: - '400': + "400": description: Invalid request - '404': + "404": description: Not found requestBody: content: @@ -700,16 +700,16 @@ paths: type: string default: $ enum: - - '>' + - ">" - $ enum_form_string: description: Form parameter enum test (string) type: string enum: - _abc - - '-efg' + - "-efg" - (xyz) - default: '-efg' + default: "-efg" post: tags: - fake @@ -725,9 +725,9 @@ paths: 가짜 엔드 포인트 operationId: testEndpointParameters responses: - '400': + "400": description: Invalid username supplied - '404': + "404": description: User not found security: - http_basic_test: [] @@ -771,11 +771,11 @@ paths: string: description: None type: string - pattern: '/[a-z]/i' + pattern: "/[a-z]/i" pattern_without_delimiter: description: None type: string - pattern: '^[A-Z].*' + pattern: "^[A-Z].*" byte: description: None type: string @@ -852,7 +852,7 @@ paths: type: integer format: int64 responses: - '400': + "400": description: Something wrong /fake/outer/number: post: @@ -861,17 +861,17 @@ paths: description: Test serialization of outer number types operationId: fakeOuterNumberSerialize responses: - '200': + "200": description: Output number content: - '*/*': + "*/*": schema: - $ref: '#/components/schemas/OuterNumber' + $ref: "#/components/schemas/OuterNumber" requestBody: content: application/json: schema: - $ref: '#/components/schemas/OuterNumber' + $ref: "#/components/schemas/OuterNumber" description: Input number as post body /fake/property/enum-int: post: @@ -880,18 +880,18 @@ paths: description: Test serialization of enum (int) properties with examples operationId: fakePropertyEnumIntegerSerialize responses: - '200': + "200": description: Output enum (int) content: - '*/*': + "*/*": schema: - $ref: '#/components/schemas/OuterObjectWithEnumProperty' + $ref: "#/components/schemas/OuterObjectWithEnumProperty" requestBody: required: true content: application/json: schema: - $ref: '#/components/schemas/OuterObjectWithEnumProperty' + $ref: "#/components/schemas/OuterObjectWithEnumProperty" description: Input enum (int) as post body /fake/outer/string: post: @@ -900,17 +900,17 @@ paths: description: Test serialization of outer string types operationId: fakeOuterStringSerialize responses: - '200': + "200": description: Output string content: - '*/*': + "*/*": schema: - $ref: '#/components/schemas/OuterString' + $ref: "#/components/schemas/OuterString" requestBody: content: application/json: schema: - $ref: '#/components/schemas/OuterString' + $ref: "#/components/schemas/OuterString" description: Input string as post body /fake/outer/boolean: post: @@ -919,17 +919,17 @@ paths: description: Test serialization of outer boolean types operationId: fakeOuterBooleanSerialize responses: - '200': + "200": description: Output boolean content: - '*/*': + "*/*": schema: - $ref: '#/components/schemas/OuterBoolean' + $ref: "#/components/schemas/OuterBoolean" requestBody: content: application/json: schema: - $ref: '#/components/schemas/OuterBoolean' + $ref: "#/components/schemas/OuterBoolean" description: Input boolean as post body /fake/outer/composite: post: @@ -938,17 +938,17 @@ paths: description: Test serialization of object with outer number type operationId: fakeOuterCompositeSerialize responses: - '200': + "200": description: Output composite content: - '*/*': + "*/*": schema: - $ref: '#/components/schemas/OuterComposite' + $ref: "#/components/schemas/OuterComposite" requestBody: content: application/json: schema: - $ref: '#/components/schemas/OuterComposite' + $ref: "#/components/schemas/OuterComposite" description: Input composite as post body /fake/BigDecimalMap: get: @@ -957,10 +957,10 @@ paths: description: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys operationId: fakeBigDecimalMap responses: - '200': + "200": description: successful operation content: - '*/*': + "*/*": schema: type: object properties: @@ -975,10 +975,10 @@ paths: tags: - fake summary: test json serialization of form data - description: '' + description: "" operationId: testJsonFormData responses: - '200': + "200": description: successful operation requestBody: content: @@ -1000,16 +1000,16 @@ paths: tags: - fake summary: test referenced additionalProperties - description: '' + description: "" operationId: testAdditionalPropertiesReference responses: - '200': + "200": description: successful operation requestBody: content: application/json: schema: - $ref: '#/components/schemas/FreeFormObject' + $ref: "#/components/schemas/FreeFormObject" description: request body required: true /fake/stringMap-reference: @@ -1017,16 +1017,16 @@ paths: tags: - fake summary: test referenced string map - description: '' + description: "" operationId: testStringMapReference responses: - '200': + "200": description: successful operation requestBody: content: application/json: schema: - $ref: '#/components/schemas/MapOfString' + $ref: "#/components/schemas/MapOfString" description: request body required: true /fake/inline-additionalProperties: @@ -1034,10 +1034,10 @@ paths: tags: - fake summary: test inline additionalProperties - description: '' + description: "" operationId: testInlineAdditionalProperties responses: - '200': + "200": description: successful operation requestBody: content: @@ -1053,10 +1053,10 @@ paths: tags: - fake summary: test inline free-form additionalProperties - description: '' + description: "" operationId: testInlineFreeformAdditionalProperties responses: - '200': + "200": description: successful operation requestBody: content: @@ -1080,7 +1080,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ChildWithNullable' + $ref: "#/components/schemas/ChildWithNullable" description: request body required: true responses: @@ -1098,13 +1098,13 @@ paths: schema: type: string responses: - '200': + "200": description: Success requestBody: content: application/json: schema: - $ref: '#/components/schemas/User' + $ref: "#/components/schemas/User" required: true /another-fake/dummy: patch: @@ -1112,16 +1112,16 @@ paths: - $another-fake? summary: To test special tags description: To test special tags and operation ID starting with number - operationId: '123_test_@#$%_special_tags' + operationId: "123_test_@#$%_special_tags" responses: - '200': + "200": description: successful operation content: application/json: schema: - $ref: '#/components/schemas/Client' + $ref: "#/components/schemas/Client" requestBody: - $ref: '#/components/requestBodies/Client' + $ref: "#/components/requestBodies/Client" /fake/body-with-file-schema: put: tags: @@ -1131,13 +1131,13 @@ paths: `File`. operationId: testBodyWithFileSchema responses: - '200': + "200": description: Success requestBody: content: application/json: schema: - $ref: '#/components/schemas/FileSchemaTestClass' + $ref: "#/components/schemas/FileSchemaTestClass" required: true /fake/body-with-binary: put: @@ -1147,7 +1147,7 @@ paths: For this test, the body has to be a binary file. operationId: testBodyWithBinary responses: - '200': + "200": description: Success requestBody: content: @@ -1224,12 +1224,12 @@ paths: responses: "200": description: Success - '/fake/{petId}/uploadImageWithRequiredFile': + "/fake/{petId}/uploadImageWithRequiredFile": post: tags: - pet summary: uploads an image (required) - description: '' + description: "" operationId: uploadFileWithRequiredFile parameters: - name: petId @@ -1240,16 +1240,16 @@ paths: type: integer format: int64 responses: - '200': + "200": description: successful operation content: application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: "#/components/schemas/ApiResponse" security: - petstore_auth: - - 'write:pets' - - 'read:pets' + - "write:pets" + - "read:pets" requestBody: content: multipart/form-data: @@ -1276,7 +1276,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/HealthCheckResult' + $ref: "#/components/schemas/HealthCheckResult" /fake/http-signature-test: get: tags: @@ -1299,20 +1299,20 @@ paths: security: - http_signature_test: [] requestBody: - $ref: '#/components/requestBodies/Pet' + $ref: "#/components/requestBodies/Pet" responses: 200: description: The instance started successfully servers: - - url: 'http://{server}.swagger.io:{port}/v2' + - url: "http://{server}.swagger.io:{port}/v2" description: petstore server variables: server: enum: - - 'petstore' - - 'qa-petstore' - - 'dev-petstore' - default: 'petstore' + - "petstore" + - "qa-petstore" + - "dev-petstore" + default: "petstore" port: enum: - 80 @@ -1323,9 +1323,9 @@ servers: variables: version: enum: - - 'v1' - - 'v2' - default: 'v2' + - "v1" + - "v2" + default: "v2" - url: https://127.0.0.1/no_varaible description: The local server without variables components: @@ -1336,24 +1336,24 @@ components: schema: type: array items: - $ref: '#/components/schemas/User' + $ref: "#/components/schemas/User" description: List of user object required: true Client: content: application/json: schema: - $ref: '#/components/schemas/Client' + $ref: "#/components/schemas/Client" description: client model required: true Pet: content: application/json: schema: - $ref: '#/components/schemas/Pet' + $ref: "#/components/schemas/Pet" application/xml: schema: - $ref: '#/components/schemas/Pet' + $ref: "#/components/schemas/Pet" description: Pet object that needs to be added to the store required: true securitySchemes: @@ -1361,10 +1361,10 @@ components: type: oauth2 flows: implicit: - authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" scopes: - 'write:pets': modify pets in your account - 'read:pets': read your pets + "write:pets": modify pets in your account + "read:pets": read your pets api_key: type: apiKey name: api_key @@ -1388,7 +1388,7 @@ components: type: object properties: bar: - $ref: '#/components/schemas/Bar' + $ref: "#/components/schemas/Bar" Bar: type: string default: bar @@ -1478,7 +1478,7 @@ components: format: int64 x-is-unique: true category: - $ref: '#/components/schemas/Category' + $ref: "#/components/schemas/Category" name: type: string example: doggie @@ -1497,7 +1497,7 @@ components: name: tag wrapped: true items: - $ref: '#/components/schemas/Tag' + $ref: "#/components/schemas/Tag" status: type: string description: pet status in the store @@ -1561,14 +1561,14 @@ components: type: string Dog: allOf: - - $ref: '#/components/schemas/Animal' + - $ref: "#/components/schemas/Animal" - type: object properties: breed: type: string Cat: allOf: - - $ref: '#/components/schemas/Animal' + - $ref: "#/components/schemas/Animal" - type: object properties: declawed: @@ -1578,8 +1578,8 @@ components: discriminator: propertyName: className mapping: - DOG: '#/components/schemas/Dog' - CAT: '#/components/schemas/Cat' + DOG: "#/components/schemas/Dog" + CAT: "#/components/schemas/Cat" required: - className properties: @@ -1591,7 +1591,7 @@ components: AnimalFarm: type: array items: - $ref: '#/components/schemas/Animal' + $ref: "#/components/schemas/Animal" format_test: type: object required: @@ -1631,7 +1631,7 @@ components: format: number string: type: string - pattern: '/[a-z]/i' + pattern: "/[a-z]/i" byte: type: string format: byte @@ -1663,10 +1663,10 @@ components: pattern: '/^image_\d{1,3}$/i' EnumClass: type: string - default: '-efg' + default: "-efg" enum: - _abc - - '-efg' + - "-efg" - (xyz) Enum_Test: type: object @@ -1678,13 +1678,13 @@ components: enum: - UPPER - lower - - '' + - "" enum_string_required: type: string enum: - UPPER - lower - - '' + - "" enum_integer: type: integer format: int32 @@ -1698,13 +1698,13 @@ components: - 1.1 - -1.2 outerEnum: - $ref: '#/components/schemas/OuterEnum' + $ref: "#/components/schemas/OuterEnum" outerEnumInteger: - $ref: '#/components/schemas/OuterEnumInteger' + $ref: "#/components/schemas/OuterEnumInteger" outerEnumDefaultValue: - $ref: '#/components/schemas/OuterEnumDefaultValue' + $ref: "#/components/schemas/OuterEnumDefaultValue" outerEnumIntegerDefaultValue: - $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" AdditionalPropertiesClass: type: object properties: @@ -1730,7 +1730,7 @@ components: map: type: object additionalProperties: - $ref: '#/components/schemas/Animal' + $ref: "#/components/schemas/Animal" List: type: object properties: @@ -1796,7 +1796,7 @@ components: additionalProperties: type: boolean indirect_map: - $ref: '#/components/schemas/StringBooleanMap' + $ref: "#/components/schemas/StringBooleanMap" ArrayTest: type: object properties: @@ -1818,7 +1818,7 @@ components: items: type: array items: - $ref: '#/components/schemas/ReadOnlyFirst' + $ref: "#/components/schemas/ReadOnlyFirst" NumberOnly: type: object properties: @@ -1846,7 +1846,7 @@ components: just_symbol: type: string enum: - - '>=' + - ">=" - $ array_enum: type: array @@ -1874,33 +1874,33 @@ components: OuterEnumInteger: type: integer enum: - - 0 - - 1 - - 2 + - 0 + - 1 + - 2 example: 2 OuterEnumDefaultValue: type: string enum: - - placed - - approved - - delivered + - placed + - approved + - delivered default: placed OuterEnumIntegerDefaultValue: type: integer enum: - - 0 - - 1 - - 2 + - 0 + - 1 + - 2 default: 0 OuterComposite: type: object properties: my_number: - $ref: '#/components/schemas/OuterNumber' + $ref: "#/components/schemas/OuterNumber" my_string: - $ref: '#/components/schemas/OuterString' + $ref: "#/components/schemas/OuterString" my_boolean: - $ref: '#/components/schemas/OuterBoolean' + $ref: "#/components/schemas/OuterBoolean" OuterNumber: type: number OuterString: @@ -1922,7 +1922,7 @@ components: nullable: true ChildWithNullable: allOf: - - $ref: '#/components/schemas/ParentWithNullable' + - $ref: "#/components/schemas/ParentWithNullable" - type: object properties: otherProperty: @@ -1934,11 +1934,11 @@ components: type: object properties: file: - $ref: '#/components/schemas/File' + $ref: "#/components/schemas/File" files: type: array items: - $ref: '#/components/schemas/File' + $ref: "#/components/schemas/File" File: type: object description: Must be named `File` for test. @@ -1948,11 +1948,11 @@ components: type: string _special_model.name_: properties: - '$special[property.name]': + "$special[property.name]": type: integer format: int64 xml: - name: '$special[model.name]' + name: "$special[model.name]" HealthCheckResult: type: object properties: @@ -2026,7 +2026,7 @@ components: - value properties: value: - $ref: '#/components/schemas/OuterEnumInteger' + $ref: "#/components/schemas/OuterEnumInteger" DeprecatedObject: type: object deprecated: true @@ -2042,12 +2042,12 @@ components: type: number deprecated: true deprecatedRef: - $ref: '#/components/schemas/DeprecatedObject' + $ref: "#/components/schemas/DeprecatedObject" bars: type: array deprecated: true items: - $ref: '#/components/schemas/Bar' + $ref: "#/components/schemas/Bar" AllOfWithSingleRef: type: object properties: @@ -2055,7 +2055,12 @@ components: type: string SingleRefType: allOf: - - $ref: '#/components/schemas/SingleRefType' + - $ref: "#/components/schemas/SingleRefType" + Any: + type: object + properties: + "@type": + type: string SingleRefType: type: string title: SingleRefType diff --git a/samples/client/petstore/elixir/.openapi-generator/FILES b/samples/client/petstore/elixir/.openapi-generator/FILES index aadc7af9aa6..baf3f42cbc2 100644 --- a/samples/client/petstore/elixir/.openapi-generator/FILES +++ b/samples/client/petstore/elixir/.openapi-generator/FILES @@ -17,6 +17,7 @@ lib/openapi_petstore/model/_special_model_name_.ex lib/openapi_petstore/model/additional_properties_class.ex lib/openapi_petstore/model/all_of_with_single_ref.ex lib/openapi_petstore/model/animal.ex +lib/openapi_petstore/model/any.ex lib/openapi_petstore/model/api_response.ex lib/openapi_petstore/model/array_of_array_of_number_only.ex lib/openapi_petstore/model/array_of_number_only.ex diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex new file mode 100644 index 00000000000..752351449d9 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/any.ex @@ -0,0 +1,22 @@ +# NOTE: This file is auto generated by OpenAPI Generator 7.11.0-SNAPSHOT (https://openapi-generator.tech). +# Do not edit this file manually. + +defmodule OpenapiPetstore.Model.Any do + @moduledoc """ + + """ + + @derive Jason.Encoder + defstruct [ + :"@type" + ] + + @type t :: %__MODULE__{ + :"@type" => String.t | nil + } + + def decode(value) do + value + end +end + diff --git a/samples/client/petstore/elixir/test/any_test.exs b/samples/client/petstore/elixir/test/any_test.exs new file mode 100644 index 00000000000..de9b3e095b4 --- /dev/null +++ b/samples/client/petstore/elixir/test/any_test.exs @@ -0,0 +1,14 @@ +defmodule AnyTest do + use ExUnit.Case, async: true + alias OpenapiPetstore.Model.Any, as: Model + + test "decode all properties (not nil)" do + assert %Model{ + "@type": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + } + |> Model.decode() == + %Model{ + "@type": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + } + end +end