Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
41e97e6
Mustache template should use invokerPackage tag to generate import
sebastien-rosset May 13, 2020
1760f6a
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 13, 2020
3ae466e
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 13, 2020
b628667
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 13, 2020
4dc915c
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 14, 2020
7a207f6
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 16, 2020
776fba6
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 18, 2020
3fac434
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 19, 2020
a96c46b
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 20, 2020
1351fd0
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 21, 2020
ba65735
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 22, 2020
9a0b89e
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 22, 2020
4c84190
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 22, 2020
94ae683
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 22, 2020
aac9f5a
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 23, 2020
93baa3d
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 23, 2020
5c313b4
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 23, 2020
cda8898
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 23, 2020
1f7e5c1
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 24, 2020
bef435e
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 25, 2020
a9cad38
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 26, 2020
877ecfe
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 27, 2020
8c055f5
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 27, 2020
d64f421
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 28, 2020
4d0edfe
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 28, 2020
476eb01
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 29, 2020
8ff6088
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 30, 2020
ac1a061
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 30, 2020
8579966
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 31, 2020
7c45925
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset May 31, 2020
7f52a53
Merge remote-tracking branch 'upstream/master'
vvb Jun 1, 2020
76d3348
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 1, 2020
797e779
Merge branch 'master' of github.com:CiscoM31/openapi-generator
sebastien-rosset Jun 1, 2020
700e0f9
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 2, 2020
cf45a86
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 2, 2020
ad3fa7e
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 4, 2020
12ecf34
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 4, 2020
6321dfc
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 4, 2020
c05b82e
add JsonSubTypes annotation to handle scenario when OAS name has spec…
sebastien-rosset Jun 4, 2020
92eadd7
add JsonSubTypes annotation to handle scenario when OAS name has spec…
sebastien-rosset Jun 4, 2020
ae8e870
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 5, 2020
a8d8b96
Merge branch 'master' of github.com:CiscoM31/openapi-generator into j…
sebastien-rosset Jun 5, 2020
97e490e
run sample scripts
sebastien-rosset Jun 5, 2020
3237fc6
fix unit test
sebastien-rosset Jun 5, 2020
d1f351b
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 5, 2020
5e2f013
run sample scripts
sebastien-rosset Jun 5, 2020
5d7aa84
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 8, 2020
76996aa
Merge branch 'master' of https://github.com/OpenAPITools/openapi-gene…
sebastien-rosset Jun 9, 2020
a873091
resolve merge conflicts
sebastien-rosset Jun 9, 2020
6ff9965
resolve merge conflicts. sync from master
sebastien-rosset Jul 7, 2020
ed663e0
add minimal openapi document to show issue with special characters an…
sebastien-rosset Jul 7, 2020
db62818
Add 'isClassnameSanitized' tag
sebastien-rosset Jul 7, 2020
b312cee
Add 'isClassnameSanitized' tag
sebastien-rosset Jul 7, 2020
12bfcd4
Add 'isClassnameSanitized' tag
sebastien-rosset Jul 7, 2020
c4a42a3
Add 'isClassnameSanitized' tag
sebastien-rosset Jul 7, 2020
e701504
Add 'isClassnameSanitized' tag
sebastien-rosset Jul 7, 2020
72f6a30
Add 'isClassnameSanitized' tag
sebastien-rosset Jul 7, 2020
9636649
Merge branch 'master' of github.com:CiscoM31/openapi-generator into j…
sebastien-rosset Jul 9, 2020
27a0c6c
Add unit tests for unmarshaling of discriminators with special charac…
sebastien-rosset Jul 14, 2020
05b168f
Merge branch 'master' of github.com:CiscoM31/openapi-generator into j…
sebastien-rosset Jul 14, 2020
da0dcc1
Add unit tests for unmarshaling of discriminators with special charac…
sebastien-rosset Jul 14, 2020
2a4c15a
Merge branch 'master' of github.com:CiscoM31/openapi-generator into j…
sebastien-rosset Jul 17, 2020
1f5fc0c
use JsonTypeName
wing328 Jul 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add unit tests for unmarshaling of discriminators with special charac…
…ters
  • Loading branch information
sebastien-rosset committed Jul 14, 2020
commit 27a0c6c8c85ce7f0024a46b4727cfcd5f6ec83aa
15 changes: 15 additions & 0 deletions bin/configs/java-jersey2-special-characters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
generatorName: java
outputDir: samples/openapi3/client/petstore/java/jersey2-java8-special-characters
library: jersey2
inputSpec: modules/openapi-generator/src/test/resources/3_0/schema-with-special-characters.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-openapi3-jersey2-java8-special-characters
hideGenerationTimestamp: true
serverPort: "8082"
dateLibrary: java8
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
systemProperties:
skipValidateSpec: "false"

Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ components:
schemas:
Parent:
properties:
prop1:
objectType:
type: string
discriminator:
propertyName: prop1
propertyName: objectType
ChildSchema:
description: A schema that does not have any special character.
allOf:
- $ref: '#/components/schemas/Parent'
- type: object
properties:
prop1:
type: string
# Note: the name below with non-ASCII characters is a valid JSON schema name,
# however currently OpenAPI generator does not allow special characters beyond [.-_]
#
Expand All @@ -48,6 +56,10 @@ components:
prop2:
type: string
# Below is a schema with the same name, except special characters have been removed.
# This causes a codegen issue because the generated code will have exactly the same class name
# as the above 'MySchemaName._-Characters'.
# Hence the schema is commented out for now.
#
#MySchemaNameCharacters:
# description:
# A schema with same name as above, without the special characters.
Expand All @@ -56,4 +68,4 @@ components:
# - type: object
# properties:
# prop2:
# type: string
# type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# exclude jar for gradle wrapper
!gradle/wrapper/*.jar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# build files
**/target
target
.gradle
build
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gitignore
.travis.yml
README.md
api/openapi.yaml
build.gradle
build.sbt
docs/ChildSchema.md
docs/ChildSchemaAllOf.md
docs/DefaultApi.md
docs/MySchemaNameCharacters.md
docs/MySchemaNameCharactersAllOf.md
docs/Parent.md
git_push.sh
gradle.properties
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
gradlew
gradlew.bat
pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiException.java
src/main/java/org/openapitools/client/ApiResponse.java
src/main/java/org/openapitools/client/Configuration.java
src/main/java/org/openapitools/client/JSON.java
src/main/java/org/openapitools/client/Pair.java
src/main/java/org/openapitools/client/RFC3339DateFormat.java
src/main/java/org/openapitools/client/ServerConfiguration.java
src/main/java/org/openapitools/client/ServerVariable.java
src/main/java/org/openapitools/client/StringUtil.java
src/main/java/org/openapitools/client/api/DefaultApi.java
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
src/main/java/org/openapitools/client/auth/Authentication.java
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/ChildSchema.java
src/main/java/org/openapitools/client/model/ChildSchemaAllOf.java
src/main/java/org/openapitools/client/model/MySchemaNameCharacters.java
src/main/java/org/openapitools/client/model/MySchemaNameCharactersAllOf.java
src/main/java/org/openapitools/client/model/Parent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.0.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
# Ref: https://docs.travis-ci.com/user/languages/java/
#
language: java
jdk:
- openjdk12
- openjdk11
- openjdk10
- openjdk9
- openjdk8
before_install:
# ensure gradlew has proper permission
- chmod a+x ./gradlew
script:
# test using maven
#- mvn test
# test using gradle
- gradle test
# test using sbt
# - sbt test
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# petstore-openapi3-jersey2-java8-special-characters

test

- API version: 1.0.0

test


*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*

## Requirements

Building the API client library requires:

1. Java 1.8+
2. Maven/Gradle

## Installation

To install the API client library to your local Maven repository, simply execute:

```shell
mvn clean install
```

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

```shell
mvn clean deploy
```

Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.

### Maven users

Add this dependency to your project's POM:

```xml
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>petstore-openapi3-jersey2-java8-special-characters</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
```

### Gradle users

Add this dependency to your project's build file:

```groovy
compile "org.openapitools:petstore-openapi3-jersey2-java8-special-characters:1.0.0"
```

### Others

At first generate the JAR by executing:

```shell
mvn clean package
```

Then manually install the following JARs:

- `target/petstore-openapi3-jersey2-java8-special-characters-1.0.0.jar`
- `target/lib/*.jar`

## Getting Started

Please follow the [installation](#installation) instruction and execute the following Java code:

```java

import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {

public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost");

DefaultApi apiInstance = new DefaultApi(defaultClient);
MySchemaNameCharacters mySchemaNameCharacters = new MySchemaNameCharacters(); // MySchemaNameCharacters |
try {
MySchemaNameCharacters result = apiInstance.testPost(mySchemaNameCharacters);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#testPost");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

```

## Documentation for API Endpoints

All URIs are relative to *http://localhost*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**testPost**](docs/DefaultApi.md#testPost) | **POST** /test |


## Documentation for Models

- [ChildSchema](docs/ChildSchema.md)
- [ChildSchemaAllOf](docs/ChildSchemaAllOf.md)
- [MySchemaNameCharacters](docs/MySchemaNameCharacters.md)
- [MySchemaNameCharactersAllOf](docs/MySchemaNameCharactersAllOf.md)
- [Parent](docs/Parent.md)


## Documentation for Authorization

All endpoints do not require authorization.
Authentication schemes defined for the API:

## Recommendation

It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

## Author



Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
openapi: 3.0.3
info:
description: test
title: test
version: 1.0.0
servers:
- url: /
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MySchemaName._-Characters'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/MySchemaName._-Characters'
description: the response
x-contentType: application/json
x-accepts: application/json
components:
schemas:
Parent:
discriminator:
propertyName: objectType
properties:
objectType:
type: string
ChildSchema:
allOf:
- $ref: '#/components/schemas/Parent'
- $ref: '#/components/schemas/ChildSchema_allOf'
description: A schema that does not have any special character.
MySchemaName._-Characters:
allOf:
- $ref: '#/components/schemas/Parent'
- $ref: '#/components/schemas/MySchemaName___Characters_allOf'
description: A schema name that has letters, numbers, punctuation and non-ASCII
characters. The sanitization rules should make it possible to generate a language-specific
classname with allowed characters in that programming language.
ChildSchema_allOf:
properties:
prop1:
type: string
MySchemaName___Characters_allOf:
properties:
prop2:
type: string

Loading