-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[JAVA](bugfix) indentation error for java client generator #23228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
07148b3
12ab4d2
f2a3be9
ef47a9d
f4fe3d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| generatorName: java | ||
| outputDir: samples/client/others/java/restclient-sealedInterface | ||
| library: restclient | ||
| inputSpec: modules/openapi-generator/src/test/resources/3_1/oneof_polymorphism_and_inheritance.yaml | ||
| templateDir: modules/openapi-generator/src/main/resources/Java | ||
| additionalProperties: | ||
| artifactId: sealed-interface-restClient | ||
| hideGenerationTimestamp: "true" | ||
| useSealedOneOfInterfaces: true | ||
| useOneOfInterfaces: true | ||
| serializableModel: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| {{#useSealedOneOfInterfaces}}{{#vendorExtensions.x-is-one-of-interface}}{{#permits.0}}sealed {{/permits.0}}{{/vendorExtensions.x-is-one-of-interface}}{{^permits.0}}{{#vendorExtensions.x-implements}}final {{/vendorExtensions.x-implements}}{{/permits.0}}{{/useSealedOneOfInterfaces}} | ||
| {{#useSealedOneOfInterfaces}}{{#vendorExtensions.x-is-one-of-interface}}{{#permits.0}}sealed {{/permits.0}}{{/vendorExtensions.x-is-one-of-interface}}{{^permits.0}}{{#vendorExtensions.x-implements}}{{#-first}}final {{/-first}}{{/vendorExtensions.x-implements}}{{/permits.0}}{{/useSealedOneOfInterfaces}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
| # | ||
| # This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) | ||
|
|
||
| name: Java CI with Maven | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] | ||
| pull_request: | ||
| branches: [ main, master ] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build ByRefOrValue | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| java: [ 17, 21 ] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up JDK | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: ${{ matrix.java }} | ||
| distribution: 'temurin' | ||
| cache: maven | ||
| - name: Build with Maven | ||
| run: mvn -B package --no-transfer-progress --file pom.xml |
| 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,74 @@ | ||
| .github/workflows/maven.yml | ||
| .gitignore | ||
| .travis.yml | ||
| README.md | ||
| api/openapi.yaml | ||
| build.gradle | ||
| build.sbt | ||
| docs/Addressable.md | ||
| docs/Animal.md | ||
| docs/Apple.md | ||
| docs/Banana.md | ||
| docs/Bar.md | ||
| docs/BarApi.md | ||
| docs/BarCreate.md | ||
| docs/BarRef.md | ||
| docs/BarRefOrValue.md | ||
| docs/Cat.md | ||
| docs/Dog.md | ||
| docs/Entity.md | ||
| docs/EntityRef.md | ||
| docs/Extensible.md | ||
| docs/Foo.md | ||
| docs/FooApi.md | ||
| docs/FooRef.md | ||
| docs/FooRefOrValue.md | ||
| docs/Fruit.md | ||
| docs/FruitType.md | ||
| docs/Pasta.md | ||
| docs/Pizza.md | ||
| docs/PizzaSpeziale.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/JavaTimeFormatter.java | ||
| src/main/java/org/openapitools/client/RFC3339DateFormat.java | ||
| src/main/java/org/openapitools/client/RFC3339InstantDeserializer.java | ||
| src/main/java/org/openapitools/client/RFC3339JavaTimeModule.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/BarApi.java | ||
| src/main/java/org/openapitools/client/api/FooApi.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/Addressable.java | ||
| src/main/java/org/openapitools/client/model/Animal.java | ||
| src/main/java/org/openapitools/client/model/Apple.java | ||
| src/main/java/org/openapitools/client/model/Banana.java | ||
| src/main/java/org/openapitools/client/model/Bar.java | ||
| src/main/java/org/openapitools/client/model/BarCreate.java | ||
| src/main/java/org/openapitools/client/model/BarRef.java | ||
| src/main/java/org/openapitools/client/model/BarRefOrValue.java | ||
| src/main/java/org/openapitools/client/model/Cat.java | ||
| src/main/java/org/openapitools/client/model/Dog.java | ||
| src/main/java/org/openapitools/client/model/Entity.java | ||
| src/main/java/org/openapitools/client/model/EntityRef.java | ||
| src/main/java/org/openapitools/client/model/Extensible.java | ||
| src/main/java/org/openapitools/client/model/Foo.java | ||
| src/main/java/org/openapitools/client/model/FooRef.java | ||
| src/main/java/org/openapitools/client/model/FooRefOrValue.java | ||
| src/main/java/org/openapitools/client/model/Fruit.java | ||
| src/main/java/org/openapitools/client/model/FruitType.java | ||
| src/main/java/org/openapitools/client/model/Pasta.java | ||
| src/main/java/org/openapitools/client/model/Pizza.java | ||
| src/main/java/org/openapitools/client/model/PizzaSpeziale.java |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 7.21.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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Travis CI JDK matrix is incompatible with the sample’s Java 17+ build requirements, so CI does not validate the intended feature level. Prompt for AI agents |
||
| - 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,162 @@ | ||
| # sealed-interface-restClient | ||
|
|
||
| ByRefOrValue | ||
|
|
||
| - API version: 0.0.1 | ||
|
|
||
| - Generator version: 7.21.0-SNAPSHOT | ||
|
|
||
| This tests for a oneOf interface representation | ||
|
|
||
|
|
||
|
|
||
| *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* | ||
|
|
||
| ## Requirements | ||
|
|
||
| Building the API client library requires: | ||
|
|
||
| 1. Java 17+ | ||
| 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>sealed-interface-restClient</artifactId> | ||
| <version>0.0.1</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| ### Gradle users | ||
|
|
||
| Add this dependency to your project's build file: | ||
|
|
||
| ```groovy | ||
| repositories { | ||
| mavenCentral() // Needed if the 'sealed-interface-restClient' jar has been published to maven central. | ||
| mavenLocal() // Needed if the 'sealed-interface-restClient' jar has been published to the local maven repo. | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation "org.openapitools:sealed-interface-restClient:0.0.1" | ||
| } | ||
| ``` | ||
|
|
||
| ### Others | ||
|
|
||
| At first generate the JAR by executing: | ||
|
|
||
| ```shell | ||
| mvn clean package | ||
| ``` | ||
|
|
||
| Then manually install the following JARs: | ||
|
|
||
| - `target/sealed-interface-restClient-0.0.1.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.BarApi; | ||
|
|
||
| public class BarApiExample { | ||
|
|
||
| public static void main(String[] args) { | ||
| ApiClient defaultClient = new ApiClient(); | ||
| defaultClient.setBasePath("http://localhost:8080"); | ||
|
|
||
| BarApi apiInstance = new BarApi(defaultClient); | ||
| BarCreate barCreate = new BarCreate(); // BarCreate | | ||
| try { | ||
| Bar result = apiInstance.createBar(barCreate); | ||
| System.out.println(result); | ||
| } catch (HttpStatusCodeException e) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Generated README sample catches Prompt for AI agents |
||
| System.err.println("Exception when calling BarApi#createBar"); | ||
| System.err.println("Status code: " + e.getStatusCode().value()); | ||
| System.err.println("Reason: " + e.getResponseBodyAsString()); | ||
| System.err.println("Response headers: " + e.getResponseHeaders()); | ||
| e.printStackTrace(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| ## Documentation for API Endpoints | ||
|
|
||
| All URIs are relative to *http://localhost:8080* | ||
|
|
||
| Class | Method | HTTP request | Description | ||
| ------------ | ------------- | ------------- | ------------- | ||
| *BarApi* | [**createBar**](docs/BarApi.md#createBar) | **POST** /bar | Create a Bar | ||
| *FooApi* | [**createFoo**](docs/FooApi.md#createFoo) | **POST** /foo | Create a Foo | ||
| *FooApi* | [**getAllFoos**](docs/FooApi.md#getAllFoos) | **GET** /foo | GET all Foos | ||
|
|
||
|
|
||
| ## Documentation for Models | ||
|
|
||
| - [Addressable](docs/Addressable.md) | ||
| - [Animal](docs/Animal.md) | ||
| - [Apple](docs/Apple.md) | ||
| - [Banana](docs/Banana.md) | ||
| - [Bar](docs/Bar.md) | ||
| - [BarCreate](docs/BarCreate.md) | ||
| - [BarRef](docs/BarRef.md) | ||
| - [BarRefOrValue](docs/BarRefOrValue.md) | ||
| - [Cat](docs/Cat.md) | ||
| - [Dog](docs/Dog.md) | ||
| - [Entity](docs/Entity.md) | ||
| - [EntityRef](docs/EntityRef.md) | ||
| - [Extensible](docs/Extensible.md) | ||
| - [Foo](docs/Foo.md) | ||
| - [FooRef](docs/FooRef.md) | ||
| - [FooRefOrValue](docs/FooRefOrValue.md) | ||
| - [Fruit](docs/Fruit.md) | ||
| - [FruitType](docs/FruitType.md) | ||
| - [Pasta](docs/Pasta.md) | ||
| - [Pizza](docs/Pizza.md) | ||
| - [PizzaSpeziale](docs/PizzaSpeziale.md) | ||
|
|
||
|
|
||
| <a id="documentation-for-authorization"></a> | ||
| ## Documentation for Authorization | ||
|
|
||
| Endpoints do not require authorization. | ||
|
|
||
|
|
||
| ## Recommendation | ||
|
|
||
| It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. | ||
|
|
||
| ## Author | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.