From bb3096c99c316b8c09c8666faed04daf67df3286 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 28 Sep 2023 16:53:20 +0800 Subject: [PATCH] Jaxrs jersey3 server (#16676) * Introduced Jersey3 to JavaJerseyServerCodgen and its test class * Added date ParamConverterProvider to new jersey3 resource directory * Copied and adjusted jaxrs-jersey2 directory to jaxrs-jersey3 * Added unit tests for Jersey2 (jakarta|javax) and jersey3 (jakarta only) * Added Jersey3 to markdown documentation * Added several mustache files for Jersey3 * Further adjustments in JavaJerseyServerCodegen for Jersey3 * Removed tabs from JavaJerseyServerCodegen * Further improvements in pom and web template * Changed to swagger-jaxrs2-servlet-initializer-v2 within the projects pom * Changed servlet-initializer to jakarta version * Removed tabs in JavaJerseyServerCodegenTest.java * Removed tabs from JavaJerseyServerCodegen * Out commented Swagger 1.x part in api.mustache (see ApiImplicitParams) * Exchanged import of javax* by jakarta* in file verify.groovy * Changed Parameter annotations to Schema annotations * Added web.mustache for jersey3 According to the 'Swagger 2.X Integration and Configuration' doc at https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration * Adjusted README to point to ./openapi.json instead of ./swagger.json * Added ./bin/configs/jaxrs-jersey-jersey3.yaml as requested * Added new jersey3 example (see ./samples/server/petstore/jaxrs/jersey3 * Corrected formParams.mustache exchanged @FormParam by QueryParam * Resolved ModelValidationException for Map query parameter * Improved api.mustache (layout and deprecated class instantiation ) * Updated jersey3 example under ./samples/server/petstore/jaxrs/jersey3 * fix tests * add jeresey3 to github workflow test * add new workflow * remove jersey3 --------- Co-authored-by: CDerksen --- .github/workflows/samples-jaxrs-jdk11.yaml | 36 ++ bin/configs/jaxrs-jersey-jersey3.yaml | 9 + docs/generators/jaxrs-jersey.md | 2 +- .../src/it/jaxrs-jersey3/invoker.properties | 3 + .../src/it/jaxrs-jersey3/pom.xml | 67 +++ .../jaxrs-jersey3/templates/README.mustache | 21 + .../src/it/jaxrs-jersey3/verify.groovy | 37 ++ .../languages/JavaJerseyServerCodegen.java | 25 +- .../jersey3/LocalDateProvider.mustache | 28 + .../jersey3/OffsetDateTimeProvider.mustache | 28 + .../libraries/jersey3/README.mustache | 24 + .../JavaJaxRS/libraries/jersey3/api.mustache | 89 +++ .../libraries/jersey3/bodyParams.mustache | 13 + .../libraries/jersey3/bootstrap.mustache | 50 ++ .../libraries/jersey3/formParams.mustache | 32 ++ .../libraries/jersey3/headerParams.mustache | 1 + .../jersey3/jacksonJsonProvider.mustache | 29 + .../libraries/jersey3/pathParams.mustache | 15 + .../JavaJaxRS/libraries/jersey3/pojo.mustache | 140 +++++ .../JavaJaxRS/libraries/jersey3/pom.mustache | 229 ++++++++ .../libraries/jersey3/queryParams.mustache | 27 + .../JavaJaxRS/libraries/jersey3/web.mustache | 44 ++ .../jaxrs/JavaJerseyServerCodegenTest.java | 57 ++ .../jaxrs/jersey3/.openapi-generator-ignore | 23 + .../jaxrs/jersey3/.openapi-generator/FILES | 89 +++ .../jaxrs/jersey3/.openapi-generator/VERSION | 1 + .../server/petstore/jaxrs/jersey3/README.md | 24 + samples/server/petstore/jaxrs/jersey3/pom.xml | 216 ++++++++ .../org/openapitools/api/AnotherFakeApi.java | 73 +++ .../api/AnotherFakeApiService.java | 20 + .../org/openapitools/api/ApiException.java | 37 ++ .../org/openapitools/api/ApiOriginFilter.java | 22 + .../openapitools/api/ApiResponseMessage.java | 66 +++ .../java/org/openapitools/api/FakeApi.java | 333 +++++++++++ .../org/openapitools/api/FakeApiService.java | 55 ++ .../api/FakeClassnameTestApi.java | 73 +++ .../api/FakeClassnameTestApiService.java | 20 + .../gen/java/org/openapitools/api/FooApi.java | 72 +++ .../org/openapitools/api/FooApiService.java | 20 + .../openapitools/api/JacksonJsonProvider.java | 29 + .../openapitools/api/NotFoundException.java | 10 + .../gen/java/org/openapitools/api/PetApi.java | 178 ++++++ .../org/openapitools/api/PetApiService.java | 30 + .../openapitools/api/RFC3339DateFormat.java | 38 ++ .../java/org/openapitools/api/StoreApi.java | 118 ++++ .../org/openapitools/api/StoreApiService.java | 24 + .../java/org/openapitools/api/StringUtil.java | 42 ++ .../java/org/openapitools/api/UserApi.java | 165 ++++++ .../org/openapitools/api/UserApiService.java | 28 + .../model/AdditionalPropertiesClass.java | 140 +++++ .../model/AllOfWithSingleRef.java | 124 +++++ .../java/org/openapitools/model/Animal.java | 130 +++++ .../model/ArrayOfArrayOfNumberOnly.java | 107 ++++ .../openapitools/model/ArrayOfNumberOnly.java | 107 ++++ .../org/openapitools/model/ArrayTest.java | 177 ++++++ .../openapitools/model/Capitalization.java | 230 ++++++++ .../gen/java/org/openapitools/model/Cat.java | 96 ++++ .../java/org/openapitools/model/Category.java | 122 +++++ .../openapitools/model/ChildWithNullable.java | 97 ++++ .../org/openapitools/model/ClassModel.java | 96 ++++ .../java/org/openapitools/model/Client.java | 95 ++++ .../openapitools/model/DeprecatedObject.java | 95 ++++ .../gen/java/org/openapitools/model/Dog.java | 96 ++++ .../org/openapitools/model/EnumArrays.java | 196 +++++++ .../org/openapitools/model/EnumClass.java | 62 +++ .../java/org/openapitools/model/EnumTest.java | 418 ++++++++++++++ .../model/FakeBigDecimalMap200Response.java | 134 +++++ .../model/FileSchemaTestClass.java | 134 +++++ .../gen/java/org/openapitools/model/Foo.java | 95 ++++ .../model/FooGetDefaultResponse.java | 97 ++++ .../org/openapitools/model/FormatTest.java | 515 ++++++++++++++++++ .../openapitools/model/HasOnlyReadOnly.java | 123 +++++ .../openapitools/model/HealthCheckResult.java | 96 ++++ .../java/org/openapitools/model/MapTest.java | 242 ++++++++ ...ropertiesAndAdditionalPropertiesClass.java | 162 ++++++ .../openapitools/model/Model200Response.java | 124 +++++ .../openapitools/model/ModelApiResponse.java | 150 +++++ .../org/openapitools/model/ModelFile.java | 97 ++++ .../org/openapitools/model/ModelList.java | 96 ++++ .../org/openapitools/model/ModelReturn.java | 97 ++++ .../gen/java/org/openapitools/model/Name.java | 177 ++++++ .../org/openapitools/model/NullableClass.java | 447 +++++++++++++++ .../org/openapitools/model/NumberOnly.java | 96 ++++ .../model/ObjectWithDeprecatedFields.java | 189 +++++++ .../java/org/openapitools/model/Order.java | 265 +++++++++ .../openapitools/model/OuterComposite.java | 150 +++++ .../org/openapitools/model/OuterEnum.java | 62 +++ .../model/OuterEnumDefaultValue.java | 62 +++ .../openapitools/model/OuterEnumInteger.java | 62 +++ .../model/OuterEnumIntegerDefaultValue.java | 62 +++ .../model/OuterObjectWithEnumProperty.java | 97 ++++ .../model/ParentWithNullable.java | 159 ++++++ .../gen/java/org/openapitools/model/Pet.java | 289 ++++++++++ .../org/openapitools/model/ReadOnlyFirst.java | 122 +++++ .../org/openapitools/model/SingleRefType.java | 60 ++ .../openapitools/model/SpecialModelName.java | 96 ++++ .../gen/java/org/openapitools/model/Tag.java | 122 +++++ ...neFreeformAdditionalPropertiesRequest.java | 98 ++++ .../gen/java/org/openapitools/model/User.java | 284 ++++++++++ .../java/org/openapitools/api/Bootstrap.java | 50 ++ .../AnotherFakeApiServiceFactory.java | 13 + .../api/factories/FakeApiServiceFactory.java | 13 + .../FakeClassnameTestApiServiceFactory.java | 13 + .../api/factories/FooApiServiceFactory.java | 13 + .../api/factories/PetApiServiceFactory.java | 13 + .../api/factories/StoreApiServiceFactory.java | 13 + .../api/factories/UserApiServiceFactory.java | 13 + .../api/impl/AnotherFakeApiServiceImpl.java | 23 + .../api/impl/FakeApiServiceImpl.java | 138 +++++ .../impl/FakeClassnameTestApiServiceImpl.java | 23 + .../api/impl/FooApiServiceImpl.java | 23 + .../api/impl/PetApiServiceImpl.java | 61 +++ .../api/impl/StoreApiServiceImpl.java | 39 ++ .../api/impl/UserApiServiceImpl.java | 59 ++ .../jersey3/src/main/webapp/WEB-INF/web.xml | 44 ++ 115 files changed, 10807 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/samples-jaxrs-jdk11.yaml create mode 100644 bin/configs/jaxrs-jersey-jersey3.yaml create mode 100644 modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/invoker.properties create mode 100644 modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/pom.xml create mode 100644 modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/templates/README.mustache create mode 100644 modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/verify.groovy create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/LocalDateProvider.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/OffsetDateTimeProvider.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bodyParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bootstrap.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/formParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/headerParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/jacksonJsonProvider.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pathParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pojo.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/queryParams.mustache create mode 100644 modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/web.mustache create mode 100644 samples/server/petstore/jaxrs/jersey3/.openapi-generator-ignore create mode 100644 samples/server/petstore/jaxrs/jersey3/.openapi-generator/FILES create mode 100644 samples/server/petstore/jaxrs/jersey3/.openapi-generator/VERSION create mode 100644 samples/server/petstore/jaxrs/jersey3/README.md create mode 100644 samples/server/petstore/jaxrs/jersey3/pom.xml create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiException.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiOriginFilter.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiResponseMessage.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/JacksonJsonProvider.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/NotFoundException.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/RFC3339DateFormat.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StringUtil.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApi.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApiService.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Animal.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayTest.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Capitalization.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Cat.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Category.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ChildWithNullable.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ClassModel.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Client.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/DeprecatedObject.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Dog.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumArrays.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumClass.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumTest.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FileSchemaTestClass.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Foo.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FormatTest.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HealthCheckResult.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MapTest.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Model200Response.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelApiResponse.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelFile.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelList.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelReturn.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Name.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NullableClass.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NumberOnly.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Order.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterComposite.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnum.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumInteger.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ParentWithNullable.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Pet.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ReadOnlyFirst.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SingleRefType.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SpecialModelName.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Tag.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/User.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/Bootstrap.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java create mode 100644 samples/server/petstore/jaxrs/jersey3/src/main/webapp/WEB-INF/web.xml diff --git a/.github/workflows/samples-jaxrs-jdk11.yaml b/.github/workflows/samples-jaxrs-jdk11.yaml new file mode 100644 index 00000000000..f97f134ba97 --- /dev/null +++ b/.github/workflows/samples-jaxrs-jdk11.yaml @@ -0,0 +1,36 @@ +name: Samples JAX-RS (JDK11) + +on: + push: + paths: + - samples/server/petstore/jaxrs/jersey3/** + pull_request: + paths: + - samples/server/petstore/jaxrs/jersey3/** +jobs: + build: + name: Build JAX-RS + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + # servers + - samples/server/petstore/jaxrs/jersey3 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 11 + - name: Cache maven dependencies + uses: actions/cache@v3 + env: + cache-name: maven-repository + with: + path: | + ~/.m2 + key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + - name: Build + working-directory: ${{ matrix.sample }} + run: mvn clean package diff --git a/bin/configs/jaxrs-jersey-jersey3.yaml b/bin/configs/jaxrs-jersey-jersey3.yaml new file mode 100644 index 00000000000..87a4fb6cc23 --- /dev/null +++ b/bin/configs/jaxrs-jersey-jersey3.yaml @@ -0,0 +1,9 @@ +generatorName: jaxrs-jersey +outputDir: samples/server/petstore/jaxrs/jersey3 +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS +library: jersey3 +additionalProperties: + artifactId: jaxrs-jersey3-petstore-server + hideGenerationTimestamp: "true" + serverPort: "8082" \ No newline at end of file diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md index 47bf4126e07..7fb90a08c42 100644 --- a/docs/generators/jaxrs-jersey.md +++ b/docs/generators/jaxrs-jersey.md @@ -49,7 +49,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |implicitHeadersRegex|Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true| |null| |invokerPackage|root package for generated code| |org.openapitools.api| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|library|library template (sub-template)|
**jersey2**
Jersey core 2.x
|jersey2| +|library|library template (sub-template)|
**jersey2**
Jersey core 2.x
**jersey3**
Jersey core 3.x
|jersey2| |licenseName|The name of the license| |Unlicense| |licenseUrl|The URL of the license| |http://unlicense.org| |modelPackage|package for generated models| |org.openapitools.model| diff --git a/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/invoker.properties b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/invoker.properties new file mode 100644 index 00000000000..7ca0a57da2a --- /dev/null +++ b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/invoker.properties @@ -0,0 +1,3 @@ +invoker.goals = -nsu clean generate-sources +# The expected result of the build, possible values are "success" (default) and "failure" +invoker.buildResult = success diff --git a/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/pom.xml b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/pom.xml new file mode 100644 index 00000000000..35ba8150e86 --- /dev/null +++ b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/pom.xml @@ -0,0 +1,67 @@ + + + + + 4.0.0 + + org.openapitools.maven.its + jaxrs-jersey3 + 1.0-SNAPSHOT + + + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.0 + + 11 + 11 + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml + jaxrs-jersey + jersey3 + java8 + ${basedir}/out + ${project.basedir}/templates + + + + + + remote + generate-sources + + generate + + + + + + + diff --git a/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/templates/README.mustache b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/templates/README.mustache new file mode 100644 index 00000000000..cee4f752e72 --- /dev/null +++ b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/templates/README.mustache @@ -0,0 +1,21 @@ +# TEST TEST TEST + +# {{artifactId}} + +{{appName}} + +- API version: {{appVersion}} +{{^hideGenerationTimestamp}} + +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + +{{#appDescriptionWithNewLines}}{{{appDescriptionWithNewLines}}}{{/appDescriptionWithNewLines}} + +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +… etc. diff --git a/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/verify.groovy b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/verify.groovy new file mode 100644 index 00000000000..40ba52de40d --- /dev/null +++ b/modules/openapi-generator-maven-plugin/src/it/jaxrs-jersey3/verify.groovy @@ -0,0 +1,37 @@ +/* + * Copyright 2022 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +File readme = new File(basedir, "out/README.md") + +assert readme.isFile() +assert readme.text.contains("# TEST TEST TEST") +assert readme.text.contains("# openapi-jaxrs-server") +assert readme.text.contains("OpenAPI Petstore") + +File mavenPomXml = new File(basedir, "out/pom.xml") +assert mavenPomXml.isFile() + +File petApi = new File(basedir, "out/src/gen/java/org/openapitools/api/PetApi.java") +assert petApi.isFile() +assert petApi.text.contains("import org.openapitools.api.PetApiService;") + +File petApiService = new File(basedir, "out/src/gen/java/org/openapitools/api/PetApiService.java") +assert petApiService.isFile() +assert petApiService.text.contains("import jakarta.ws.rs.core.Response;") + +File petModel = new File(basedir, "out/src/gen/java/org/openapitools/model/Pet.java") +assert petModel.isFile() +assert petModel.text.contains("public class Pet") diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java index 80e38e74b15..3ddb064eda0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJerseyServerCodegen.java @@ -30,7 +30,8 @@ import java.util.*; public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { protected static final String LIBRARY_JERSEY2 = "jersey2"; - + protected static final String LIBRARY_JERSEY3 = "jersey3"; + /** * Default library template to use. (Default: jersey2) */ @@ -58,6 +59,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { CliOption library = new CliOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC).defaultValue(DEFAULT_JERSEY_LIBRARY); supportedLibraries.put(LIBRARY_JERSEY2, "Jersey core 2.x"); + supportedLibraries.put(LIBRARY_JERSEY3, "Jersey core 3.x"); library.setEnum(supportedLibraries); cliOptions.add(library); } @@ -79,7 +81,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { property.example = null; } - //Add imports for Jackson + // --- Add imports for Jackson ---------- if (!BooleanUtils.toBoolean(model.isEnum)) { model.imports.add("JsonProperty"); @@ -87,6 +89,12 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { model.imports.add("JsonValue"); } } + + // --- Imports for Swagger2 ------------- + if (this.isLibrary(LIBRARY_JERSEY3)) { + model.imports.add("Schema"); + } + } @Override @@ -95,9 +103,18 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen { // use default library if unset if (StringUtils.isEmpty(library)) { - setLibrary(DEFAULT_JERSEY_LIBRARY); + this.setLibrary(DEFAULT_JERSEY_LIBRARY); + + } else if (this.isLibrary(LIBRARY_JERSEY3)) { + // --- Ensure to use Jakarta for jersey3 ---- + this.setUseJakartaEe(true); + additionalProperties.put(USE_JAKARTA_EE, true); + this.applyJakartaPackage(); + // --- Set Swagger2 annotations --------------- + annotationLibrary = AnnotationLibrary.SWAGGER2; + } - + if (additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); } diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/LocalDateProvider.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/LocalDateProvider.mustache new file mode 100644 index 00000000000..18e114f8ef9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/LocalDateProvider.mustache @@ -0,0 +1,28 @@ +package {{apiPackage}}; + +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.time.LocalDate; + +@Provider +public class LocalDateProvider implements ParamConverterProvider { + + public ParamConverter getConverter(Class clazz, Type type, Annotation[] annotations) { + if (clazz.getName().equals(LocalDate.class.getName())) { + return new ParamConverter() { + @SuppressWarnings("unchecked") + public T fromString(String value) { + return value!=null ? (T) LocalDate.parse(value) : null; + } + + public String toString(T bean) { + return bean!=null ? bean.toString() : ""; + } + }; + } + return null; + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/OffsetDateTimeProvider.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/OffsetDateTimeProvider.mustache new file mode 100644 index 00000000000..c8bacdbeac6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/OffsetDateTimeProvider.mustache @@ -0,0 +1,28 @@ +package {{apiPackage}}; + +import jakarta.ws.rs.ext.ParamConverter; +import jakarta.ws.rs.ext.ParamConverterProvider; +import jakarta.ws.rs.ext.Provider; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.time.OffsetDateTime; + +@Provider +public class OffsetDateTimeProvider implements ParamConverterProvider { + + public ParamConverter getConverter(Class clazz, Type type, Annotation[] annotations) { + if (clazz.getName().equals(OffsetDateTime.class.getName())) { + return new ParamConverter() { + @SuppressWarnings("unchecked") + public T fromString(String value) { + return value != null ? (T) OffsetDateTime.parse(value) : null; + } + + public String toString(T bean) { + return bean != null ? bean.toString() : ""; + } + }; + } + return null; + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/README.mustache new file mode 100644 index 00000000000..57426f06965 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/README.mustache @@ -0,0 +1,24 @@ +# JAX-RS/Jersey server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey3-jaxrs` is used to derive the OpenAPI Specification from the annotated code. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the OpenAPI v2 specification here: + +``` +http://localhost:{{serverPort}}{{contextPath}}/openapi.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/api.mustache new file mode 100644 index 00000000000..775f9e13e23 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/api.mustache @@ -0,0 +1,89 @@ +package {{package}}; + +{{#models.0}} +import {{modelPackage}}.*; +{{/models.0}} +import {{package}}.{{classname}}Service; +import {{package}}.factories.{{classname}}ServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.Map; +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import {{javaxPackage}}.servlet.ServletConfig; +import {{javaxPackage}}.ws.rs.core.Context; +import {{javaxPackage}}.ws.rs.core.Response; +import {{javaxPackage}}.ws.rs.core.SecurityContext; +import {{javaxPackage}}.ws.rs.*; +{{#useBeanValidation}} +import {{javaxPackage}}.validation.constraints.*; +import {{javaxPackage}}.validation.Valid; +{{/useBeanValidation}} + +@Path("{{commonPath}}") +{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}} +{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}} +@Tag(description = "the {{{baseName}}} API", name = "") +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + + private final {{classname}}Service delegate; + + public {{classname}}(@Context ServletConfig servletContext) { + + {{classname}}Service delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("{{classname}}.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = ({{classname}}Service) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = {{classname}}ServiceFactory.get{{classname}}(); + } + this.delegate = delegate; + } + +{{#operation}} + + @{{javaxPackage}}.ws.rs.{{httpMethod}}{{! + }}{{#subresourceOperation}} + @Path("{{{path}}}"){{/subresourceOperation}}{{! + }}{{#hasConsumes}} + @Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}{{! + }}{{#hasProduces}} + @Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}} + @Operation(summary = "{{{summary}}}", description = "{{{description}}}", responses = { + {{#responses}} + @ApiResponse(responseCode = "{{{code}}}", description = "{{{message}}}", content = + @Content(schema = @Schema(implementation = {{{baseType}}}.class))), + {{/responses}} + }, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) + public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.{{nickname}}({{#allParams}}{{#isFormParam}}{{#isFile}}{{paramName}}Bodypart{{/isFile}}{{/isFormParam}}{{^isFile}}{{paramName}}{{/isFile}}{{^isFormParam}}{{#isFile}}{{paramName}}{{/isFile}}{{/isFormParam}}, {{/allParams}}securityContext); + } +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bodyParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bodyParams.mustache new file mode 100644 index 00000000000..2bd5d3fc794 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bodyParams.mustache @@ -0,0 +1,13 @@ +{{#isBodyParam}}{{! + + }}@Schema(description = "{{{description}}}"{{! + }}{{#required}}, required = true{{/required}}{{! + }}{{#allowableValues}}, {{> allowableValues}}{{/allowableValues}}{{! + }}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}{{! + }}){{! + + }}{{#useBeanValidation}} {{>beanValidation}}{{/useBeanValidation}}{{! + + }} {{{dataType}}} {{paramName}}{{! + +}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bootstrap.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bootstrap.mustache new file mode 100644 index 00000000000..177f2e6fbd3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/bootstrap.mustache @@ -0,0 +1,50 @@ +package {{apiPackage}}; + +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder; +import io.swagger.v3.oas.integration.*; +import io.swagger.v3.oas.models.*; +import io.swagger.v3.oas.models.info.*; + +import {{javaxPackage}}.servlet.http.HttpServlet; +import {{javaxPackage}}.servlet.ServletConfig; +import {{javaxPackage}}.servlet.ServletException; + +public class Bootstrap extends HttpServlet { + + private static final long serialVersionUID = 20230810; + + @Override + public void init(ServletConfig config) throws ServletException { + + Info info = new Info() + .title("{{title}}") + .description("{{{appDescription}}}") + .termsOfService("{{termsOfService}}") + .contact(new Contact() + .email("{{infoEmail}}")) + .license(new License() + .name("{{licenseInfo}}") + .url("{{licenseUrl}}")); + + OpenAPI oas = new OpenAPI(); + oas.info(info); + + SwaggerConfiguration openApiConfig = new SwaggerConfiguration() + .openAPI(oas) + .prettyPrint(true) + .resourcePackages(Stream.of("io.swagger.sample.resource").collect(Collectors.toSet())); + + try { + new JaxrsOpenApiContextBuilder() + .servletConfig(config) + .openApiConfiguration(openApiConfig) + .buildContext(true); + + } catch (OpenApiConfigurationException e) { + throw new RuntimeException(e.getMessage(), e); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/formParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/formParams.mustache new file mode 100644 index 00000000000..804fc69d930 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/formParams.mustache @@ -0,0 +1,32 @@ +{{#isFormParam}}{{! + }}{{^isFile}}{{! + + }}@Schema(description = "{{{description}}}"{{! + + }}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{! + + }}{{#defaultValue}}, defaultValue="{{{.}}}"{{/defaultValue}}){{! + + }}{{#vendorExtensions.x-multipart}}{{! + }}@FormDataParam("{{baseName}}") {{{dataType}}} {{paramName}}{{! + }}{{/vendorExtensions.x-multipart}}{{! + + }}{{^vendorExtensions.x-multipart}}{{! + }}{{#defaultValue}} @DefaultValue("{{{.}}}"){{/defaultValue}}{{! + }} @QueryParam("{{baseName}}"){{! + + }} {{{dataType}}} {{paramName}}{{! + }}{{/vendorExtensions.x-multipart}}{{! + }}{{/isFile}}{{! + + }}{{#isFile}}{{! + }}{{^isArray}}{{! + }}@FormDataParam("{{baseName}}") FormDataBodyPart {{paramName}}Bodypart{{! + }}{{/isArray}}{{! + + }}{{#isArray}}{{! + }}@FormDataParam("{{baseName}}") List {{paramName}}Bodypart{{! + }}{{/isArray}}{{! + }}{{/isFile}}{{! + +}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/headerParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/headerParams.mustache new file mode 100644 index 00000000000..80b2cb71650 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@Schema(description = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{.}}}"{{/defaultValue}})@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/jacksonJsonProvider.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/jacksonJsonProvider.mustache new file mode 100644 index 00000000000..7c2bf4b6a71 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/jacksonJsonProvider.mustache @@ -0,0 +1,29 @@ +package {{apiPackage}}; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import com.fasterxml.jackson.datatype.jsr310.*; + +import com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider; + +import {{javaxPackage}}.ws.rs.Produces; +import {{javaxPackage}}.ws.rs.core.MediaType; +import {{javaxPackage}}.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonXmlBindJsonProvider { + + public JacksonJsonProvider() { + + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .registerModule(new JavaTimeModule()) + .setDateFormat(new RFC3339DateFormat()); + + setMapper(objectMapper); + } +} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pathParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pathParams.mustache new file mode 100644 index 00000000000..26dcfabbbb4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pathParams.mustache @@ -0,0 +1,15 @@ +{{#isPathParam}}{{! + + }}@Schema(description= "{{{description}}}"{{! + }}{{#required}}, required = true{{/required}}{{! + }}{{#allowableValues}}, {{> allowableValues}}{{/allowableValues}}{{! + }}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}{{! + }}){{! + + }} @PathParam("{{baseName}}"){{! + + }}{{#useBeanValidation}} {{>beanValidation}}{{/useBeanValidation}}{{! + + }} {{{dataType}}} {{paramName}}{{! + +}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pojo.mustache new file mode 100644 index 00000000000..19b10be5e32 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pojo.mustache @@ -0,0 +1,140 @@ +/** + * {{description}}{{^description}}{{classname}}{{/description}} + */{{#description}} +@Schema(description = "{{{.}}}"){{/description}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>enumClass}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>enumClass}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{/jackson}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + + {{/vars}} + {{#vars}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } + this.{{name}}.add({{name}}Item); + return this; + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMap}} + + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + **/ + {{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} + {{/vendorExtensions.x-extra-annotation}} + {{#jackson}} + @JsonProperty(value = "{{baseName}}"{{#isReadOnly}}, access = JsonProperty.Access.READ_ONLY{{/isReadOnly}}{{#isWriteOnly}}, access = JsonProperty.Access.WRITE_ONLY{{/isWriteOnly}}) + {{/jackson}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}") + {{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + } + + {{#vendorExtensions.x-setter-extra-annotation}}{{{vendorExtensions.x-setter-extra-annotation}}} + {{/vendorExtensions.x-setter-extra-annotation}}public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + + {{/vars}} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} + return {{#parent}}super.equals(o) && {{/parent}}{{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{#-last}};{{/-last}}{{/vars}}{{/hasVars}}{{^hasVars}}{{#parent}}return super.equals(o);{{/parent}}{{^parent}}return true;{{/parent}}{{/hasVars}} + } + + @Override + public int hashCode() { + return {{^hasVars}}{{#parent}}super.hashCode(){{/parent}}{{^parent}}1{{/parent}}{{/hasVars}}{{#hasVars}}Objects.hash({{#vars}}{{#parent}}super.hashCode(), {{/parent}}{{name}}{{^-last}}, {{/-last}}{{/vars}}){{/hasVars}}; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache new file mode 100644 index 00000000000..f20595bb5b5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache @@ -0,0 +1,229 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + war + {{artifactId}} + {{artifactVersion}} + +{{#parentOverridden}} + + {{parentGroupId}} + {{parentArtifactId}} + {{parentVersion}} + +{{/parentOverridden}} + + + + {{licenseName}} + {{licenseUrl}} + repo + + + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + war + jar + + + / + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + {{serverPort}} + 60000 + + +{{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + +{{/useBeanValidation}} + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + io.swagger.core.v3 + swagger-jaxrs2-jakarta + compile + ${swagger-core-version} + + + io.swagger.core.v3 + swagger-jaxrs2-servlet-initializer-v2-jakarta + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey3-version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey3-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey3-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + + + + com.brsanthu + migbase64 + 2.2 + + + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.0 + + + com.sun.xml.bind + jaxb-impl + 4.0.3 + runtime + +{{#useBeanValidation}} + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + +{{/useBeanValidation}} + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 11 + ${java.version} + ${java.version} + 2.2.15 +{{#useBeanValidation}} + 3.0.2 +{{/useBeanValidation}} + 11.0.15 + 3.1.3 + 2.15.2 + 4.13.2 + 1.4.9 + 5.0.0 + UTF-8 + + diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/queryParams.mustache new file mode 100644 index 00000000000..16982f4575f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/queryParams.mustache @@ -0,0 +1,27 @@ +{{#isQueryParam}}{{! + + }}@Schema(description = "{{{description}}}"{{! + }}{{^isContainer}}{{! + }}{{#allowableValues}}, {{> allowableValues}}{{/allowableValues}}{{! + }}{{#defaultValue}}, defaultValue = "{{{.}}}"{{/defaultValue}}{{! + }}{{/isContainer}}{{! + }}){{! + + }}{{^isContainer}}{{! + }}{{#defaultValue}}{{! + }} @DefaultValue("{{{defaultValue}}}"){{! + }}{{/defaultValue}}{{! + }}{{/isContainer}}{{! + + }}{{^isMap}}{{! + }} @QueryParam("{{baseName}}"){{! + }}{{/isMap}}{{! + }}{{#isMap}}{{! + }} @Parameter(description="{{baseName}}"){{! + }}{{/isMap}}{{! + + }}{{#useBeanValidation}} {{>beanValidation}}{{/useBeanValidation}}{{! + + }} {{{dataType}}} {{paramName}}{{! + +}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/web.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/web.mustache new file mode 100644 index 00000000000..ab0f9d37cdc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/web.mustache @@ -0,0 +1,44 @@ + + + + + jersey + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + + io.swagger.v3.jaxrs2.integration.resources, + {{apiPackage}} + + + + jersey.config.server.provider.classnames + org.glassfish.jersey.media.multipart.MultiPartFeature + + + jersey.config.server.wadl.disableWadl + true + + 1 + + + + Bootstrap + {{apiPackage}}.Bootstrap + 2 + + + jersey + {{contextPath}}/* + + + ApiOriginFilter + {{apiPackage}}.ApiOriginFilter + + + ApiOriginFilter + /* + + diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java index e89c4644c4f..8bfc4b12815 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java @@ -2,6 +2,7 @@ package org.openapitools.codegen.java.jaxrs; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; @@ -31,6 +32,7 @@ import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -47,6 +49,7 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest { Assert.assertEquals(codegen.getName(), "jaxrs-jersey"); Assert.assertEquals(codegen.getTemplatingEngine().getClass(), MustacheEngineAdapter.class); Assert.assertEquals(codegen.getDateLibrary(), "legacy"); + Assert.assertEquals(codegen.supportedLibraries().keySet(), ImmutableSet.of("jersey2", "jersey3")); Assert.assertNull(codegen.getInputSpec()); codegen.processOpts(); @@ -134,8 +137,62 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest { return files.stream().collect(Collectors.toMap(e -> e.getName().replace(outputPath, ""), i -> i)); } + @Test + public void testJersey2Javax() throws Exception { + codegen.setLibrary("jersey2"); + codegen.setDateLibrary("java8"); + codegen.setUseJakartaEe(false); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/petstore.yaml"); + + files.values() + .stream() + .filter(file -> file.getName().endsWith(".java")) + .forEach(file -> { + // Jersey2 uses "javax.ws.rs" + // Let's confirm that "jakarta.ws" is not present + TestUtils.assertFileNotContains(file.toPath(), "jakarta.ws"); + }); + } + + @Test + public void testJersey2Jakarta() throws Exception { + codegen.setLibrary("jersey2"); + codegen.setDateLibrary("java8"); + codegen.setUseJakartaEe(true); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/petstore.yaml"); + + files.values() + .stream() + .filter(file -> file.getName().endsWith(".java")) + .forEach(file -> { + // Jersey2 uses "javax.ws.rs" + // Let's confirm that "jakarta.ws" is not present + TestUtils.assertFileNotContains(file.toPath(), "javax.ws"); + }); + } + + @Test + public void testJersey3() throws Exception { + codegen.setLibrary("jersey3"); + codegen.setDateLibrary("java8"); + + final Map files = generateFiles(codegen, "src/test/resources/3_0/petstore.yaml"); + + files.values() + .stream() + .filter(file -> file.getName().endsWith(".java")) + .forEach(file -> { + // Jersey3 uses "jakarta.ws.rs" + // Let's confirm that "javax.ws" is not present + TestUtils.assertFileNotContains(file.toPath(), "javax.ws"); + }); + } + @DataProvider(name = "codegenParameterMatrix") public Object[][] codegenParameterMatrix() { + final Set libraries = new JavaJerseyServerCodegen().supportedLibraries().keySet(); final List rows = new ArrayList(); for (final String jerseyLibrary: ImmutableList.of("jersey2")) { for (final String dateLibrary: ImmutableList.of("joda", "java8")) { diff --git a/samples/server/petstore/jaxrs/jersey3/.openapi-generator-ignore b/samples/server/petstore/jaxrs/jersey3/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/.openapi-generator-ignore @@ -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 diff --git a/samples/server/petstore/jaxrs/jersey3/.openapi-generator/FILES b/samples/server/petstore/jaxrs/jersey3/.openapi-generator/FILES new file mode 100644 index 00000000000..8f13f005350 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/.openapi-generator/FILES @@ -0,0 +1,89 @@ +README.md +pom.xml +src/gen/java/org/openapitools/api/AnotherFakeApi.java +src/gen/java/org/openapitools/api/AnotherFakeApiService.java +src/gen/java/org/openapitools/api/ApiException.java +src/gen/java/org/openapitools/api/ApiOriginFilter.java +src/gen/java/org/openapitools/api/ApiResponseMessage.java +src/gen/java/org/openapitools/api/FakeApi.java +src/gen/java/org/openapitools/api/FakeApiService.java +src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java +src/gen/java/org/openapitools/api/FooApi.java +src/gen/java/org/openapitools/api/FooApiService.java +src/gen/java/org/openapitools/api/JacksonJsonProvider.java +src/gen/java/org/openapitools/api/NotFoundException.java +src/gen/java/org/openapitools/api/PetApi.java +src/gen/java/org/openapitools/api/PetApiService.java +src/gen/java/org/openapitools/api/RFC3339DateFormat.java +src/gen/java/org/openapitools/api/StoreApi.java +src/gen/java/org/openapitools/api/StoreApiService.java +src/gen/java/org/openapitools/api/StringUtil.java +src/gen/java/org/openapitools/api/UserApi.java +src/gen/java/org/openapitools/api/UserApiService.java +src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/AllOfWithSingleRef.java +src/gen/java/org/openapitools/model/Animal.java +src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +src/gen/java/org/openapitools/model/ArrayTest.java +src/gen/java/org/openapitools/model/Capitalization.java +src/gen/java/org/openapitools/model/Cat.java +src/gen/java/org/openapitools/model/Category.java +src/gen/java/org/openapitools/model/ChildWithNullable.java +src/gen/java/org/openapitools/model/ClassModel.java +src/gen/java/org/openapitools/model/Client.java +src/gen/java/org/openapitools/model/DeprecatedObject.java +src/gen/java/org/openapitools/model/Dog.java +src/gen/java/org/openapitools/model/EnumArrays.java +src/gen/java/org/openapitools/model/EnumClass.java +src/gen/java/org/openapitools/model/EnumTest.java +src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java +src/gen/java/org/openapitools/model/FileSchemaTestClass.java +src/gen/java/org/openapitools/model/Foo.java +src/gen/java/org/openapitools/model/FooGetDefaultResponse.java +src/gen/java/org/openapitools/model/FormatTest.java +src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +src/gen/java/org/openapitools/model/HealthCheckResult.java +src/gen/java/org/openapitools/model/MapTest.java +src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +src/gen/java/org/openapitools/model/Model200Response.java +src/gen/java/org/openapitools/model/ModelApiResponse.java +src/gen/java/org/openapitools/model/ModelFile.java +src/gen/java/org/openapitools/model/ModelList.java +src/gen/java/org/openapitools/model/ModelReturn.java +src/gen/java/org/openapitools/model/Name.java +src/gen/java/org/openapitools/model/NullableClass.java +src/gen/java/org/openapitools/model/NumberOnly.java +src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java +src/gen/java/org/openapitools/model/Order.java +src/gen/java/org/openapitools/model/OuterComposite.java +src/gen/java/org/openapitools/model/OuterEnum.java +src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java +src/gen/java/org/openapitools/model/OuterEnumInteger.java +src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java +src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java +src/gen/java/org/openapitools/model/ParentWithNullable.java +src/gen/java/org/openapitools/model/Pet.java +src/gen/java/org/openapitools/model/ReadOnlyFirst.java +src/gen/java/org/openapitools/model/SingleRefType.java +src/gen/java/org/openapitools/model/SpecialModelName.java +src/gen/java/org/openapitools/model/Tag.java +src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java +src/gen/java/org/openapitools/model/User.java +src/main/java/org/openapitools/api/Bootstrap.java +src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java +src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java +src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java +src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java +src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java +src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java +src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java +src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java +src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java +src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java +src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java +src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +src/main/webapp/WEB-INF/web.xml diff --git a/samples/server/petstore/jaxrs/jersey3/.openapi-generator/VERSION b/samples/server/petstore/jaxrs/jersey3/.openapi-generator/VERSION new file mode 100644 index 00000000000..40e36364ab2 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey3/README.md b/samples/server/petstore/jaxrs/jersey3/README.md new file mode 100644 index 00000000000..389518cf346 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/README.md @@ -0,0 +1,24 @@ +# JAX-RS/Jersey server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey3-jaxrs` is used to derive the OpenAPI Specification from the annotated code. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the OpenAPI v2 specification here: + +``` +http://localhost:8082/v2/openapi.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey3/pom.xml b/samples/server/petstore/jaxrs/jersey3/pom.xml new file mode 100644 index 00000000000..5d5fe4957d5 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/pom.xml @@ -0,0 +1,216 @@ + + 4.0.0 + org.openapitools + jaxrs-jersey3-petstore-server + war + jaxrs-jersey3-petstore-server + 1.0.0 + + + + + Unlicense + https://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + war + jar + + + / + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 8082 + 60000 + + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + io.swagger.core.v3 + swagger-jaxrs2-jakarta + compile + ${swagger-core-version} + + + io.swagger.core.v3 + swagger-jaxrs2-servlet-initializer-v2-jakarta + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + + + jakarta.servlet + jakarta.servlet-api + ${servlet-api-version} + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey3-version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey3-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey3-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + + + + com.brsanthu + migbase64 + 2.2 + + + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.0 + + + com.sun.xml.bind + jaxb-impl + 4.0.3 + runtime + + + + jakarta.validation + jakarta.validation-api + ${beanvalidation-version} + provided + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 11 + ${java.version} + ${java.version} + 2.2.15 + 3.0.2 + 11.0.15 + 3.1.3 + 2.15.2 + 4.13.2 + 1.4.9 + 5.0.0 + UTF-8 + + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApi.java new file mode 100644 index 00000000000..a5a6406311c --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -0,0 +1,73 @@ +package org.openapitools.api; + +import org.openapitools.api.AnotherFakeApiService; +import org.openapitools.api.factories.AnotherFakeApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import org.openapitools.model.Client; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/another-fake/dummy") + + +@Tag(description = "the another-fake API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class AnotherFakeApi { + + private final AnotherFakeApiService delegate; + + public AnotherFakeApi(@Context ServletConfig servletContext) { + + AnotherFakeApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("AnotherFakeApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (AnotherFakeApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test special tags", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Client.class))), + }, tags={ "$another-fake?", }) + public Response call123testSpecialTags(@Schema(description = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.call123testSpecialTags(client, securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApiService.java new file mode 100644 index 00000000000..26d97a10d9b --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/AnotherFakeApiService.java @@ -0,0 +1,20 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class AnotherFakeApiService { + public abstract Response call123testSpecialTags(Client client,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiException.java new file mode 100644 index 00000000000..57f9d2c1378 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiException.java @@ -0,0 +1,37 @@ +package org.openapitools.api; + +/** + * The exception that can be used to store the HTTP status code returned by an API response. + */ +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ApiException extends Exception { + /** The HTTP status code. */ + private int code; + + /** + * Constructor. + * + * @param code The HTTP status code. + * @param msg The error message. + */ + public ApiException(int code, String msg) { + super(msg); + this.code = code; + } + + /** + * Get the HTTP status code. + * + * @return The HTTP status code. + */ + public int getCode() { + return code; + } + + @Override + public String toString() { + return "ApiException{" + + "code=" + code + + '}'; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiOriginFilter.java new file mode 100644 index 00000000000..3368d56690f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiOriginFilter.java @@ -0,0 +1,22 @@ +package org.openapitools.api; + +import java.io.IOException; + +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletResponse; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ApiOriginFilter implements jakarta.servlet.Filter { + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiResponseMessage.java new file mode 100644 index 00000000000..dd229aad49f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/ApiResponseMessage.java @@ -0,0 +1,66 @@ +package org.openapitools.api; + + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java new file mode 100644 index 00000000000..74445e79366 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApi.java @@ -0,0 +1,333 @@ +package org.openapitools.api; + +import org.openapitools.api.FakeApiService; +import org.openapitools.api.factories.FakeApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; +import org.openapitools.model.Client; +import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.model.User; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/fake") + + +@Tag(description = "the fake API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeApi { + + private final FakeApiService delegate; + + public FakeApi(@Context ServletConfig servletContext) { + + FakeApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("FakeApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (FakeApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = FakeApiServiceFactory.getFakeApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = FakeBigDecimalMap200Response.class))), + }, tags={ "fake", }) + public Response fakeBigDecimalMap(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeBigDecimalMap(securityContext); + } + + @jakarta.ws.rs.GET + @Path("/health") + @Produces({ "application/json" }) + @Operation(summary = "Health check endpoint", description = "", responses = { + @ApiResponse(responseCode = "200", description = "The instance started successfully", content = + @Content(schema = @Schema(implementation = HealthCheckResult.class))), + }, tags={ "fake", }) + public Response fakeHealthGet(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeHealthGet(securityContext); + } + + @jakarta.ws.rs.GET + @Path("/http-signature-test") + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "test http signature authentication", description = "", responses = { + @ApiResponse(responseCode = "200", description = "The instance started successfully", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response fakeHttpSignatureTest(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Schema(description = "query parameter") @QueryParam("query_1") String query1,@Schema(description = "header parameter" )@HeaderParam("header_1") String header1,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeHttpSignatureTest(pet, query1, header1, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/outer/boolean") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Output boolean", content = + @Content(schema = @Schema(implementation = Boolean.class))), + }, tags={ "fake", }) + public Response fakeOuterBooleanSerialize(@Schema(description = "Input boolean as post body") Boolean body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterBooleanSerialize(body, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/outer/composite") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Output composite", content = + @Content(schema = @Schema(implementation = OuterComposite.class))), + }, tags={ "fake", }) + public Response fakeOuterCompositeSerialize(@Schema(description = "Input composite as post body") @Valid OuterComposite outerComposite,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterCompositeSerialize(outerComposite, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/outer/number") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Output number", content = + @Content(schema = @Schema(implementation = BigDecimal.class))), + }, tags={ "fake", }) + public Response fakeOuterNumberSerialize(@Schema(description = "Input number as post body") BigDecimal body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterNumberSerialize(body, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/outer/string") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Output string", content = + @Content(schema = @Schema(implementation = String.class))), + }, tags={ "fake", }) + public Response fakeOuterStringSerialize(@Schema(description = "Input string as post body") String body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterStringSerialize(body, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/property/enum-int") + @Consumes({ "application/json" }) + @Produces({ "*/*" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Output enum (int)", content = + @Content(schema = @Schema(implementation = OuterObjectWithEnumProperty.class))), + }, tags={ "fake", }) + public Response fakePropertyEnumIntegerSerialize(@Schema(description = "Input enum (int) as post body", required = true) @NotNull @Valid OuterObjectWithEnumProperty outerObjectWithEnumProperty,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, securityContext); + } + + @jakarta.ws.rs.PUT + @Path("/body-with-binary") + @Consumes({ "image/png" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Success", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testBodyWithBinary(@Schema(description = "image to upload", required = true) @NotNull File body,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testBodyWithBinary(body, securityContext); + } + + @jakarta.ws.rs.PUT + @Path("/body-with-file-schema") + @Consumes({ "application/json" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Success", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testBodyWithFileSchema(@Schema(description = "", required = true) @NotNull @Valid FileSchemaTestClass fileSchemaTestClass,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testBodyWithFileSchema(fileSchemaTestClass, securityContext); + } + + @jakarta.ws.rs.PUT + @Path("/body-with-query-params") + @Consumes({ "application/json" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Success", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testBodyWithQueryParams(@Schema(description = "") @QueryParam("query") @NotNull String query,@Schema(description = "", required = true) @NotNull @Valid User user,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testBodyWithQueryParams(query, user, securityContext); + } + + @jakarta.ws.rs.PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test \"client\" model", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Client.class))), + }, tags={ "fake", }) + public Response testClientModel(@Schema(description = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testClientModel(client, securityContext); + } + + @jakarta.ws.rs.POST + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", description = "", responses = { + @ApiResponse(responseCode = "400", description = "Invalid username supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "User not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testEndpointParameters(@Schema(description = "None") @QueryParam("number") BigDecimal number,@Schema(description = "None") @QueryParam("double") Double _double,@Schema(description = "None") @QueryParam("pattern_without_delimiter") String patternWithoutDelimiter,@Schema(description = "None") @QueryParam("byte") byte[] _byte,@Schema(description = "None") @QueryParam("integer") Integer integer,@Schema(description = "None") @QueryParam("int32") Integer int32,@Schema(description = "None") @QueryParam("int64") Long int64,@Schema(description = "None") @QueryParam("float") Float _float,@Schema(description = "None") @QueryParam("string") String string,@FormDataParam("binary") FormDataBodyPart binaryBodypart,@Schema(description = "None") @QueryParam("date") Date date,@Schema(description = "None") @QueryParam("dateTime") Date dateTime,@Schema(description = "None") @QueryParam("password") String password,@Schema(description = "None") @QueryParam("callback") String paramCallback,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binaryBodypart, date, dateTime, password, paramCallback, securityContext); + } + + @jakarta.ws.rs.GET + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "To test enum parameters", description = "", responses = { + @ApiResponse(responseCode = "400", description = "Invalid request", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "Not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testEnumParameters(@Schema(description = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray,@Schema(description = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString,@Schema(description = "Query parameter enum test (string array)") @QueryParam("enum_query_string_array") @Valid List enumQueryStringArray,@Schema(description = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue = "-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString,@Schema(description = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger,@Schema(description = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble,@Schema(description = "") @QueryParam("enum_query_model_array") @Valid List enumQueryModelArray,@Schema(description = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @QueryParam("enum_form_string_array") List enumFormStringArray,@Schema(description = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_form_string") String enumFormString,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, securityContext); + } + + @jakarta.ws.rs.DELETE + @Operation(summary = "Fake endpoint to test group parameters (optional)", description = "", responses = { + @ApiResponse(responseCode = "400", description = "Something wrong", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testGroupParameters(@Schema(description = "Required String in group parameters") @QueryParam("required_string_group") @NotNull Integer requiredStringGroup,@Schema(description = "Required Boolean in group parameters" ,required=true)@HeaderParam("required_boolean_group") Boolean requiredBooleanGroup,@Schema(description = "Required Integer in group parameters") @QueryParam("required_int64_group") @NotNull Long requiredInt64Group,@Schema(description = "String in group parameters") @QueryParam("string_group") Integer stringGroup,@Schema(description = "Boolean in group parameters" )@HeaderParam("boolean_group") Boolean booleanGroup,@Schema(description = "Integer in group parameters") @QueryParam("int64_group") Long int64Group,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/inline-additionalProperties") + @Consumes({ "application/json" }) + @Operation(summary = "test inline additionalProperties", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testInlineAdditionalProperties(@Schema(description = "request body", required = true) @NotNull @Valid Map requestBody,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testInlineAdditionalProperties(requestBody, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/inline-freeform-additionalProperties") + @Consumes({ "application/json" }) + @Operation(summary = "test inline free-form additionalProperties", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testInlineFreeformAdditionalProperties(@Schema(description = "request body", required = true) @NotNull @Valid TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/jsonFormData") + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "test json serialization of form data", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testJsonFormData(@Schema(description = "field1") @QueryParam("param") String param,@Schema(description = "field2") @QueryParam("param2") String param2,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testJsonFormData(param, param2, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/nullable") + @Consumes({ "application/json" }) + @Operation(summary = "test nullable parent property", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testNullable(@Schema(description = "request body", required = true) @NotNull @Valid ChildWithNullable childWithNullable,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testNullable(childWithNullable, securityContext); + } + + @jakarta.ws.rs.PUT + @Path("/test-query-parameters") + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Success", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "fake", }) + public Response testQueryParameterCollectionFormat(@Schema(description = "") @QueryParam("pipe") @NotNull @Valid List pipe,@Schema(description = "") @QueryParam("ioutil") @NotNull @Valid List ioutil,@Schema(description = "") @QueryParam("http") @NotNull @Valid List http,@Schema(description = "") @QueryParam("url") @NotNull @Valid List url,@Schema(description = "") @QueryParam("context") @NotNull @Valid List context,@Schema(description = "") @QueryParam("allowEmpty") @NotNull String allowEmpty,@Schema(description = "") @Parameter(description="language") @Valid Map language,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/{petId}/uploadImageWithRequiredFile") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @Operation(summary = "uploads an image (required)", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = ModelApiResponse.class))), + }, tags={ "pet", }) + public Response uploadFileWithRequiredFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@FormDataParam("requiredFile") FormDataBodyPart requiredFileBodypart,@Schema(description = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.uploadFileWithRequiredFile(petId, requiredFileBodypart, additionalMetadata, securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java new file mode 100644 index 00000000000..6d30dde0220 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeApiService.java @@ -0,0 +1,55 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; +import org.openapitools.model.Client; +import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.model.User; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class FakeApiService { + public abstract Response fakeBigDecimalMap(SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeHttpSignatureTest(Pet pet,String query1,String header1,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,SecurityContext securityContext) throws NotFoundException; + public abstract Response testBodyWithBinary(File body,SecurityContext securityContext) throws NotFoundException; + public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException; + public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException; + public abstract Response testClientModel(Client client,SecurityContext securityContext) throws NotFoundException; + public abstract Response testEndpointParameters(BigDecimal number,Double _double,String patternWithoutDelimiter,byte[] _byte,Integer integer,Integer int32,Long int64,Float _float,String string,FormDataBodyPart binaryBodypart,Date date,Date dateTime,String password,String paramCallback,SecurityContext securityContext) throws NotFoundException; + public abstract Response testEnumParameters(List enumHeaderStringArray,String enumHeaderString,List enumQueryStringArray,String enumQueryString,Integer enumQueryInteger,Double enumQueryDouble,List enumQueryModelArray,List enumFormStringArray,String enumFormString,SecurityContext securityContext) throws NotFoundException; + public abstract Response testGroupParameters( @NotNull Integer requiredStringGroup, @NotNull Boolean requiredBooleanGroup, @NotNull Long requiredInt64Group,Integer stringGroup,Boolean booleanGroup,Long int64Group,SecurityContext securityContext) throws NotFoundException; + public abstract Response testInlineAdditionalProperties(Map requestBody,SecurityContext securityContext) throws NotFoundException; + public abstract Response testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest,SecurityContext securityContext) throws NotFoundException; + public abstract Response testJsonFormData(String param,String param2,SecurityContext securityContext) throws NotFoundException; + public abstract Response testNullable(ChildWithNullable childWithNullable,SecurityContext securityContext) throws NotFoundException; + public abstract Response testQueryParameterCollectionFormat( @NotNull List pipe, @NotNull List ioutil, @NotNull List http, @NotNull List url, @NotNull List context, @NotNull String allowEmpty,Map language,SecurityContext securityContext) throws NotFoundException; + public abstract Response uploadFileWithRequiredFile(Long petId,FormDataBodyPart requiredFileBodypart,String additionalMetadata,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..4bc5c0af57d --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -0,0 +1,73 @@ +package org.openapitools.api; + +import org.openapitools.api.FakeClassnameTestApiService; +import org.openapitools.api.factories.FakeClassnameTestApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import org.openapitools.model.Client; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/fake_classname_test") + + +@Tag(description = "the fake_classname_test API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeClassnameTestApi { + + private final FakeClassnameTestApiService delegate; + + public FakeClassnameTestApi(@Context ServletConfig servletContext) { + + FakeClassnameTestApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("FakeClassnameTestApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (FakeClassnameTestApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = FakeClassnameTestApiServiceFactory.getFakeClassnameTestApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.PATCH + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @Operation(summary = "To test class name in snake case", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Client.class))), + }, tags={ "fake_classname_tags 123#$%^", }) + public Response testClassname(@Schema(description = "client model", required = true) @NotNull @Valid Client client,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testClassname(client, securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java new file mode 100644 index 00000000000..e975f1f4cf4 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FakeClassnameTestApiService.java @@ -0,0 +1,20 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class FakeClassnameTestApiService { + public abstract Response testClassname(Client client,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApi.java new file mode 100644 index 00000000000..690ed38c681 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApi.java @@ -0,0 +1,72 @@ +package org.openapitools.api; + +import org.openapitools.api.FooApiService; +import org.openapitools.api.factories.FooApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import org.openapitools.model.FooGetDefaultResponse; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/foo") + + +@Tag(description = "the foo API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FooApi { + + private final FooApiService delegate; + + public FooApi(@Context ServletConfig servletContext) { + + FooApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("FooApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (FooApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = FooApiServiceFactory.getFooApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.GET + @Produces({ "application/json" }) + @Operation(summary = "", description = "", responses = { + @ApiResponse(responseCode = "200", description = "response", content = + @Content(schema = @Schema(implementation = FooGetDefaultResponse.class))), + }, tags={ }) + public Response fooGet(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fooGet(securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApiService.java new file mode 100644 index 00000000000..8f877f49ac0 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/FooApiService.java @@ -0,0 +1,20 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import org.openapitools.model.FooGetDefaultResponse; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class FooApiService { + public abstract Response fooGet(SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/JacksonJsonProvider.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/JacksonJsonProvider.java new file mode 100644 index 00000000000..0d7969ddbd9 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/JacksonJsonProvider.java @@ -0,0 +1,29 @@ +package org.openapitools.api; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import com.fasterxml.jackson.datatype.jsr310.*; + +import com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider; + +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonXmlBindJsonProvider { + + public JacksonJsonProvider() { + + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .registerModule(new JavaTimeModule()) + .setDateFormat(new RFC3339DateFormat()); + + setMapper(objectMapper); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/NotFoundException.java new file mode 100644 index 00000000000..accaa74e749 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/NotFoundException.java @@ -0,0 +1,10 @@ +package org.openapitools.api; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java new file mode 100644 index 00000000000..a7f46f3af99 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApi.java @@ -0,0 +1,178 @@ +package org.openapitools.api; + +import org.openapitools.api.PetApiService; +import org.openapitools.api.factories.PetApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/pet") + + +@Tag(description = "the pet API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class PetApi { + + private final PetApiService delegate; + + public PetApi(@Context ServletConfig servletContext) { + + PetApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("PetApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (PetApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = PetApiServiceFactory.getPetApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.POST + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "Add a new pet to the store", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "405", description = "Invalid input", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response addPet(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.addPet(pet, securityContext); + } + + @jakarta.ws.rs.DELETE + @Path("/{petId}") + @Operation(summary = "Deletes a pet", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "400", description = "Invalid pet value", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response deletePet(@Schema(description= "Pet id to delete", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deletePet(petId, apiKey, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/findByStatus") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Finds Pets by status", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Pet.class))), + @ApiResponse(responseCode = "400", description = "Invalid status value", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response findPetsByStatus(@Schema(description = "Status values that need to be considered for filter") @QueryParam("status") @NotNull @Valid List status,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByStatus(status, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/findByTags") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Finds Pets by tags", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Pet.class))), + @ApiResponse(responseCode = "400", description = "Invalid tag value", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response findPetsByTags(@Schema(description = "Tags to filter by") @QueryParam("tags") @NotNull @Valid Set tags,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByTags(tags, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/{petId}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Find pet by ID", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Pet.class))), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "Pet not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response getPetById(@Schema(description= "ID of pet to return", required = true) @PathParam("petId") @NotNull Long petId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getPetById(petId, securityContext); + } + + @jakarta.ws.rs.PUT + @Consumes({ "application/json", "application/xml" }) + @Operation(summary = "Update an existing pet", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "Pet not found", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "405", description = "Validation exception", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response updatePet(@Schema(description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid Pet pet,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePet(pet, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Operation(summary = "Updates a pet in the store with form data", description = "", responses = { + @ApiResponse(responseCode = "200", description = "Successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "405", description = "Invalid input", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "pet", }) + public Response updatePetWithForm(@Schema(description= "ID of pet that needs to be updated", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "Updated name of the pet") @QueryParam("name") String name,@Schema(description = "Updated status of the pet") @QueryParam("status") String status,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePetWithForm(petId, name, status, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @Operation(summary = "uploads an image", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = ModelApiResponse.class))), + }, tags={ "pet", }) + public Response uploadFile(@Schema(description= "ID of pet to update", required = true) @PathParam("petId") @NotNull Long petId,@Schema(description = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata,@FormDataParam("file") FormDataBodyPart _fileBodypart,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.uploadFile(petId, additionalMetadata, _fileBodypart, securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java new file mode 100644 index 00000000000..ea6f8dcda04 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/PetApiService.java @@ -0,0 +1,30 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class PetApiService { + public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; + public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; + public abstract Response findPetsByStatus( @NotNull List status,SecurityContext securityContext) throws NotFoundException; + public abstract Response findPetsByTags( @NotNull Set tags,SecurityContext securityContext) throws NotFoundException; + public abstract Response getPetById(Long petId,SecurityContext securityContext) throws NotFoundException; + public abstract Response updatePet(Pet pet,SecurityContext securityContext) throws NotFoundException; + public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) throws NotFoundException; + public abstract Response uploadFile(Long petId,String additionalMetadata,FormDataBodyPart _fileBodypart,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/RFC3339DateFormat.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/RFC3339DateFormat.java new file mode 100644 index 00000000000..3c9230efefe --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.openapitools.api; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return this; + } +} \ No newline at end of file diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApi.java new file mode 100644 index 00000000000..06bfc06a8a6 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApi.java @@ -0,0 +1,118 @@ +package org.openapitools.api; + +import org.openapitools.api.StoreApiService; +import org.openapitools.api.factories.StoreApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.util.Map; +import org.openapitools.model.Order; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/store") + + +@Tag(description = "the store API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class StoreApi { + + private final StoreApiService delegate; + + public StoreApi(@Context ServletConfig servletContext) { + + StoreApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("StoreApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (StoreApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = StoreApiServiceFactory.getStoreApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.DELETE + @Path("/order/{order_id}") + @Operation(summary = "Delete purchase order by ID", description = "", responses = { + @ApiResponse(responseCode = "400", description = "Invalid ID supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "Order not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "store", }) + public Response deleteOrder(@Schema(description= "ID of the order that needs to be deleted", required = true) @PathParam("order_id") @NotNull String orderId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteOrder(orderId, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/inventory") + @Produces({ "application/json" }) + @Operation(summary = "Returns pet inventories by status", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Map.class))), + }, tags={ "store", }) + public Response getInventory(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getInventory(securityContext); + } + + @jakarta.ws.rs.GET + @Path("/order/{order_id}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Find purchase order by ID", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Order.class))), + @ApiResponse(responseCode = "400", description = "Invalid ID supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "Order not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "store", }) + public Response getOrderById(@Schema(description= "ID of pet that needs to be fetched", required = true) @PathParam("order_id") @NotNull @Min(1L) @Max(5L) Long orderId,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getOrderById(orderId, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/order") + @Consumes({ "application/json" }) + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Place an order for a pet", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Order.class))), + @ApiResponse(responseCode = "400", description = "Invalid Order", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "store", }) + public Response placeOrder(@Schema(description = "order placed for purchasing the pet", required = true) @NotNull @Valid Order order,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.placeOrder(order, securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApiService.java new file mode 100644 index 00000000000..a16b9a9248e --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StoreApiService.java @@ -0,0 +1,24 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import java.util.Map; +import org.openapitools.model.Order; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class StoreApiService { + public abstract Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException; + public abstract Response getInventory(SecurityContext securityContext) throws NotFoundException; + public abstract Response getOrderById( @Min(1L) @Max(5L)Long orderId,SecurityContext securityContext) throws NotFoundException; + public abstract Response placeOrder(Order order,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StringUtil.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StringUtil.java new file mode 100644 index 00000000000..fe3606f5e19 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/StringUtil.java @@ -0,0 +1,42 @@ +package org.openapitools.api; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApi.java new file mode 100644 index 00000000000..66b00e1337d --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApi.java @@ -0,0 +1,165 @@ +package org.openapitools.api; + +import org.openapitools.api.UserApiService; +import org.openapitools.api.factories.UserApiServiceFactory; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import java.util.Date; +import org.openapitools.model.User; + +import java.util.Map; +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.servlet.ServletConfig; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.ws.rs.*; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +@Path("/user") + + +@Tag(description = "the user API", name = "") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class UserApi { + + private final UserApiService delegate; + + public UserApi(@Context ServletConfig servletContext) { + + UserApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("UserApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (UserApiService) Class.forName(implClass).getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = UserApiServiceFactory.getUserApi(); + } + this.delegate = delegate; + } + + + @jakarta.ws.rs.POST + @Consumes({ "application/json" }) + @Operation(summary = "Create user", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response createUser(@Schema(description = "Created user object", required = true) @NotNull @Valid User user,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUser(user, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/createWithArray") + @Consumes({ "application/json" }) + @Operation(summary = "Creates list of users with given input array", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response createUsersWithArrayInput(@Schema(description = "List of user object", required = true) @NotNull @Valid List user,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUsersWithArrayInput(user, securityContext); + } + + @jakarta.ws.rs.POST + @Path("/createWithList") + @Consumes({ "application/json" }) + @Operation(summary = "Creates list of users with given input array", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response createUsersWithListInput(@Schema(description = "List of user object", required = true) @NotNull @Valid List user,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUsersWithListInput(user, securityContext); + } + + @jakarta.ws.rs.DELETE + @Path("/{username}") + @Operation(summary = "Delete user", description = "", responses = { + @ApiResponse(responseCode = "400", description = "Invalid username supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "User not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response deleteUser(@Schema(description= "The name that needs to be deleted", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteUser(username, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/{username}") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Get user by user name", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = User.class))), + @ApiResponse(responseCode = "400", description = "Invalid username supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "User not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response getUserByName(@Schema(description= "The name that needs to be fetched. Use user1 for testing.", required = true) @PathParam("username") @NotNull String username,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getUserByName(username, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/login") + @Produces({ "application/xml", "application/json" }) + @Operation(summary = "Logs user into the system", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = String.class))), + @ApiResponse(responseCode = "400", description = "Invalid username/password supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response loginUser(@Schema(description = "The user name for login") @QueryParam("username") @NotNull String username,@Schema(description = "The password for login in clear text") @QueryParam("password") @NotNull String password,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.loginUser(username, password, securityContext); + } + + @jakarta.ws.rs.GET + @Path("/logout") + @Operation(summary = "Logs out current logged in user session", description = "", responses = { + @ApiResponse(responseCode = "200", description = "successful operation", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response logoutUser(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.logoutUser(securityContext); + } + + @jakarta.ws.rs.PUT + @Path("/{username}") + @Consumes({ "application/json" }) + @Operation(summary = "Updated user", description = "", responses = { + @ApiResponse(responseCode = "400", description = "Invalid user supplied", content = + @Content(schema = @Schema(implementation = Void.class))), + @ApiResponse(responseCode = "404", description = "User not found", content = + @Content(schema = @Schema(implementation = Void.class))), + }, tags={ "user", }) + public Response updateUser(@Schema(description= "name that need to be deleted", required = true) @PathParam("username") @NotNull String username,@Schema(description = "Updated user object", required = true) @NotNull @Valid User user,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updateUser(username, user, securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApiService.java new file mode 100644 index 00000000000..4f965efa40a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/api/UserApiService.java @@ -0,0 +1,28 @@ +package org.openapitools.api; + +import org.openapitools.api.*; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import java.util.Date; +import org.openapitools.model.User; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public abstract class UserApiService { + public abstract Response createUser(User user,SecurityContext securityContext) throws NotFoundException; + public abstract Response createUsersWithArrayInput(List user,SecurityContext securityContext) throws NotFoundException; + public abstract Response createUsersWithListInput(List user,SecurityContext securityContext) throws NotFoundException; + public abstract Response deleteUser(String username,SecurityContext securityContext) throws NotFoundException; + public abstract Response getUserByName(String username,SecurityContext securityContext) throws NotFoundException; + public abstract Response loginUser( @NotNull String username, @NotNull String password,SecurityContext securityContext) throws NotFoundException; + public abstract Response logoutUser(SecurityContext securityContext) throws NotFoundException; + public abstract Response updateUser(String username,User user,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..909c02f62f6 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * AdditionalPropertiesClass + */ +@JsonPropertyOrder({ + AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class AdditionalPropertiesClass { + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) + private Map mapProperty = new HashMap<>(); + + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) + private Map> mapOfMapProperty = new HashMap<>(); + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @JsonProperty(value = "map_property") + @Schema(description = "") + + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @JsonProperty(value = "map_of_map_property") + @Schema(description = "") + @Valid + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java new file mode 100644 index 00000000000..eba044e8b86 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/AllOfWithSingleRef.java @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.SingleRefType; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * AllOfWithSingleRef + */ +@JsonPropertyOrder({ + AllOfWithSingleRef.JSON_PROPERTY_USERNAME, + AllOfWithSingleRef.JSON_PROPERTY_SINGLE_REF_TYPE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class AllOfWithSingleRef { + public static final String JSON_PROPERTY_USERNAME = "username"; + @JsonProperty(JSON_PROPERTY_USERNAME) + private String username; + + public static final String JSON_PROPERTY_SINGLE_REF_TYPE = "SingleRefType"; + @JsonProperty(JSON_PROPERTY_SINGLE_REF_TYPE) + private SingleRefType singleRefType; + + public AllOfWithSingleRef username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @JsonProperty(value = "username") + @Schema(description = "") + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public AllOfWithSingleRef singleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + return this; + } + + /** + * Get singleRefType + * @return singleRefType + **/ + @JsonProperty(value = "SingleRefType") + @Schema(description = "") + @Valid + public SingleRefType getSingleRefType() { + return singleRefType; + } + + public void setSingleRefType(SingleRefType singleRefType) { + this.singleRefType = singleRefType; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllOfWithSingleRef allOfWithSingleRef = (AllOfWithSingleRef) o; + return Objects.equals(username, allOfWithSingleRef.username) && + Objects.equals(singleRefType, allOfWithSingleRef.singleRefType); + } + + @Override + public int hashCode() { + return Objects.hash(username, singleRefType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllOfWithSingleRef {\n"); + + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" singleRefType: ").append(toIndentedString(singleRefType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Animal.java new file mode 100644 index 00000000000..957b5616f45 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Animal.java @@ -0,0 +1,130 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Animal + */ +@JsonPropertyOrder({ + Animal.JSON_PROPERTY_CLASS_NAME, + Animal.JSON_PROPERTY_COLOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Cat.class, name = "CAT"), + @JsonSubTypes.Type(value = Dog.class, name = "DOG"), +}) + +public class Animal { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + private String className; + + public static final String JSON_PROPERTY_COLOR = "color"; + @JsonProperty(JSON_PROPERTY_COLOR) + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @JsonProperty(value = "className") + @Schema(required = true, description = "") + @NotNull + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @JsonProperty(value = "color") + @Schema(description = "") + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(className, animal.className) && + Objects.equals(color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..29498c6782a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ArrayOfArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ArrayOfArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) + private List> arrayArrayNumber; + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @JsonProperty(value = "ArrayArrayNumber") + @Schema(description = "") + @Valid + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..753ab14b4cf --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ArrayOfNumberOnly + */ +@JsonPropertyOrder({ + ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ArrayOfNumberOnly { + public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber"; + @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) + private List arrayNumber; + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @JsonProperty(value = "ArrayNumber") + @Schema(description = "") + @Valid + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayTest.java new file mode 100644 index 00000000000..8ee21a1fa73 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ArrayTest.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ReadOnlyFirst; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ArrayTest + */ +@JsonPropertyOrder({ + ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER, + ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ArrayTest { + public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string"; + @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) + private List arrayOfString; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER = "array_array_of_integer"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) + private List> arrayArrayOfInteger; + + public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model"; + @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) + private List> arrayArrayOfModel; + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @JsonProperty(value = "array_of_string") + @Schema(description = "") + @Size(min=0,max=3) + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @JsonProperty(value = "array_array_of_integer") + @Schema(description = "") + @Valid + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @JsonProperty(value = "array_array_of_model") + @Schema(description = "") + @Valid + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(arrayOfString, arrayTest.arrayOfString) && + Objects.equals(arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Capitalization.java new file mode 100644 index 00000000000..dff0c680a30 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Capitalization.java @@ -0,0 +1,230 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Capitalization + */ +@JsonPropertyOrder({ + Capitalization.JSON_PROPERTY_SMALL_CAMEL, + Capitalization.JSON_PROPERTY_CAPITAL_CAMEL, + Capitalization.JSON_PROPERTY_SMALL_SNAKE, + Capitalization.JSON_PROPERTY_CAPITAL_SNAKE, + Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS, + Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Capitalization { + public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel"; + @JsonProperty(JSON_PROPERTY_SMALL_CAMEL) + private String smallCamel; + + public static final String JSON_PROPERTY_CAPITAL_CAMEL = "CapitalCamel"; + @JsonProperty(JSON_PROPERTY_CAPITAL_CAMEL) + private String capitalCamel; + + public static final String JSON_PROPERTY_SMALL_SNAKE = "small_Snake"; + @JsonProperty(JSON_PROPERTY_SMALL_SNAKE) + private String smallSnake; + + public static final String JSON_PROPERTY_CAPITAL_SNAKE = "Capital_Snake"; + @JsonProperty(JSON_PROPERTY_CAPITAL_SNAKE) + private String capitalSnake; + + public static final String JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; + @JsonProperty(JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS) + private String scAETHFlowPoints; + + public static final String JSON_PROPERTY_A_T_T_N_A_M_E = "ATT_NAME"; + @JsonProperty(JSON_PROPERTY_A_T_T_N_A_M_E) + private String ATT_NAME; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @JsonProperty(value = "smallCamel") + @Schema(description = "") + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @JsonProperty(value = "CapitalCamel") + @Schema(description = "") + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @JsonProperty(value = "small_Snake") + @Schema(description = "") + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @JsonProperty(value = "Capital_Snake") + @Schema(description = "") + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @JsonProperty(value = "SCA_ETH_Flow_Points") + @Schema(description = "") + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @JsonProperty(value = "ATT_NAME") + @Schema(description = "Name of the pet ") + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(smallCamel, capitalization.smallCamel) && + Objects.equals(capitalCamel, capitalization.capitalCamel) && + Objects.equals(smallSnake, capitalization.smallSnake) && + Objects.equals(capitalSnake, capitalization.capitalSnake) && + Objects.equals(scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Cat.java new file mode 100644 index 00000000000..9028e3e82ba --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Cat.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Cat + */ +@JsonPropertyOrder({ + Cat.JSON_PROPERTY_DECLAWED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Cat extends Animal { + public static final String JSON_PROPERTY_DECLAWED = "declawed"; + @JsonProperty(JSON_PROPERTY_DECLAWED) + private Boolean declawed; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @JsonProperty(value = "declawed") + @Schema(description = "") + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return super.equals(o) && Objects.equals(declawed, cat.declawed); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), declawed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Category.java new file mode 100644 index 00000000000..329b7d77e02 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Category.java @@ -0,0 +1,122 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Category + */ +@JsonPropertyOrder({ + Category.JSON_PROPERTY_ID, + Category.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Category { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + private String name = "default-name"; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @JsonProperty(value = "id") + @Schema(description = "") + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(value = "name") + @Schema(required = true, description = "") + @NotNull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ChildWithNullable.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ChildWithNullable.java new file mode 100644 index 00000000000..20eb1ccb19e --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ChildWithNullable.java @@ -0,0 +1,97 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.ParentWithNullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ChildWithNullable + */ +@JsonPropertyOrder({ + ChildWithNullable.JSON_PROPERTY_OTHER_PROPERTY +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ChildWithNullable extends ParentWithNullable { + public static final String JSON_PROPERTY_OTHER_PROPERTY = "otherProperty"; + @JsonProperty(JSON_PROPERTY_OTHER_PROPERTY) + private String otherProperty; + + public ChildWithNullable otherProperty(String otherProperty) { + this.otherProperty = otherProperty; + return this; + } + + /** + * Get otherProperty + * @return otherProperty + **/ + @JsonProperty(value = "otherProperty") + @Schema(description = "") + + public String getOtherProperty() { + return otherProperty; + } + + public void setOtherProperty(String otherProperty) { + this.otherProperty = otherProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChildWithNullable childWithNullable = (ChildWithNullable) o; + return super.equals(o) && Objects.equals(otherProperty, childWithNullable.otherProperty); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), otherProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChildWithNullable {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" otherProperty: ").append(toIndentedString(otherProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ClassModel.java new file mode 100644 index 00000000000..fe3b40460e8 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ClassModel.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Model for testing model with \"_class\" property + */ +@Schema(description = "Model for testing model with \"_class\" property") +@JsonPropertyOrder({ + ClassModel.JSON_PROPERTY_PROPERTY_CLASS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ClassModel { + public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class"; + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + private String propertyClass; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @JsonProperty(value = "_class") + @Schema(description = "") + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Client.java new file mode 100644 index 00000000000..b69fb43db1a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Client.java @@ -0,0 +1,95 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_CLIENT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Client { + public static final String JSON_PROPERTY_CLIENT = "client"; + @JsonProperty(JSON_PROPERTY_CLIENT) + private String client; + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @JsonProperty(value = "client") + @Schema(description = "") + + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/DeprecatedObject.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/DeprecatedObject.java new file mode 100644 index 00000000000..92a6ac3247f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/DeprecatedObject.java @@ -0,0 +1,95 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * DeprecatedObject + */ +@JsonPropertyOrder({ + DeprecatedObject.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class DeprecatedObject { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + private String name; + + public DeprecatedObject name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(value = "name") + @Schema(description = "") + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeprecatedObject deprecatedObject = (DeprecatedObject) o; + return Objects.equals(name, deprecatedObject.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeprecatedObject {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Dog.java new file mode 100644 index 00000000000..24df67f003a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Dog.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Dog + */ +@JsonPropertyOrder({ + Dog.JSON_PROPERTY_BREED +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Dog extends Animal { + public static final String JSON_PROPERTY_BREED = "breed"; + @JsonProperty(JSON_PROPERTY_BREED) + private String breed; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @JsonProperty(value = "breed") + @Schema(description = "") + + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return super.equals(o) && Objects.equals(breed, dog.breed); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), breed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumArrays.java new file mode 100644 index 00000000000..20b44a98237 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumArrays.java @@ -0,0 +1,196 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * EnumArrays + */ +@JsonPropertyOrder({ + EnumArrays.JSON_PROPERTY_JUST_SYMBOL, + EnumArrays.JSON_PROPERTY_ARRAY_ENUM +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String value) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_JUST_SYMBOL = "just_symbol"; + @JsonProperty(JSON_PROPERTY_JUST_SYMBOL) + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String value) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ARRAY_ENUM = "array_enum"; + @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) + private List arrayEnum; + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @JsonProperty(value = "just_symbol") + @Schema(description = "") + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @JsonProperty(value = "array_enum") + @Schema(description = "") + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(justSymbol, enumArrays.justSymbol) && + Objects.equals(arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumClass.java new file mode 100644 index 00000000000..63456302439 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumClass.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String value) { + for (EnumClass b : EnumClass.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumTest.java new file mode 100644 index 00000000000..63b217c3b2a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/EnumTest.java @@ -0,0 +1,418 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.OuterEnum; +import org.openapitools.model.OuterEnumDefaultValue; +import org.openapitools.model.OuterEnumInteger; +import org.openapitools.model.OuterEnumIntegerDefaultValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * EnumTest + */ +@JsonPropertyOrder({ + EnumTest.JSON_PROPERTY_ENUM_STRING, + EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, + EnumTest.JSON_PROPERTY_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_ENUM_NUMBER, + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String value) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING = "enum_string"; + @JsonProperty(JSON_PROPERTY_ENUM_STRING) + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String value) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_STRING_REQUIRED = "enum_string_required"; + @JsonProperty(JSON_PROPERTY_ENUM_STRING_REQUIRED) + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(Integer value) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_INTEGER = "enum_integer"; + @JsonProperty(JSON_PROPERTY_ENUM_INTEGER) + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(Double value) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_NUMBER = "enum_number"; + @JsonProperty(JSON_PROPERTY_ENUM_NUMBER) + private EnumNumberEnum enumNumber; + + public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + private OuterEnum outerEnum; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @JsonProperty(value = "enum_string") + @Schema(description = "") + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @JsonProperty(value = "enum_string_required") + @Schema(required = true, description = "") + @NotNull + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @JsonProperty(value = "enum_integer") + @Schema(description = "") + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @JsonProperty(value = "enum_number") + @Schema(description = "") + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @JsonProperty(value = "outerEnum") + @Schema(description = "") + @Valid + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + **/ + @JsonProperty(value = "outerEnumInteger") + @Schema(description = "") + @Valid + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + **/ + @JsonProperty(value = "outerEnumDefaultValue") + @Schema(description = "") + @Valid + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + **/ + @JsonProperty(value = "outerEnumIntegerDefaultValue") + @Schema(description = "") + @Valid + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(enumString, enumTest.enumString) && + Objects.equals(enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(enumInteger, enumTest.enumInteger) && + Objects.equals(enumNumber, enumTest.enumNumber) && + Objects.equals(outerEnum, enumTest.outerEnum) && + Objects.equals(outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..fb9d4908690 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,134 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + @JsonProperty(JSON_PROPERTY_SOME_ID) + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + @JsonProperty(JSON_PROPERTY_SOME_MAP) + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @JsonProperty(value = "someId") + @Schema(description = "") + @Valid + public BigDecimal getSomeId() { + return someId; + } + + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @JsonProperty(value = "someMap") + @Schema(description = "") + @Valid + public Map getSomeMap() { + return someMap; + } + + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..0353d0ca69b --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -0,0 +1,134 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.ModelFile; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * FileSchemaTestClass + */ +@JsonPropertyOrder({ + FileSchemaTestClass.JSON_PROPERTY_FILE, + FileSchemaTestClass.JSON_PROPERTY_FILES +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FileSchemaTestClass { + public static final String JSON_PROPERTY_FILE = "file"; + @JsonProperty(JSON_PROPERTY_FILE) + private ModelFile _file; + + public static final String JSON_PROPERTY_FILES = "files"; + @JsonProperty(JSON_PROPERTY_FILES) + private List files; + + public FileSchemaTestClass _file(ModelFile _file) { + this._file = _file; + return this; + } + + /** + * Get _file + * @return _file + **/ + @JsonProperty(value = "file") + @Schema(description = "") + @Valid + public ModelFile getFile() { + return _file; + } + + public void setFile(ModelFile _file) { + this._file = _file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(ModelFile filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @JsonProperty(value = "files") + @Schema(description = "") + @Valid + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(_file, fileSchemaTestClass._file) && + Objects.equals(files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(_file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Foo.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Foo.java new file mode 100644 index 00000000000..4a2124e7639 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Foo.java @@ -0,0 +1,95 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Foo + */ +@JsonPropertyOrder({ + Foo.JSON_PROPERTY_BAR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + private String bar = "bar"; + + public Foo bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @JsonProperty(value = "bar") + @Schema(description = "") + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Foo foo = (Foo) o; + return Objects.equals(bar, foo.bar); + } + + @Override + public int hashCode() { + return Objects.hash(bar); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Foo {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java new file mode 100644 index 00000000000..f2213b5826b --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FooGetDefaultResponse.java @@ -0,0 +1,97 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.Foo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * FooGetDefaultResponse + */ +@JsonPropertyOrder({ + FooGetDefaultResponse.JSON_PROPERTY_STRING +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FooGetDefaultResponse { + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + private Foo string; + + public FooGetDefaultResponse string(Foo string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @JsonProperty(value = "string") + @Schema(description = "") + @Valid + public Foo getString() { + return string; + } + + public void setString(Foo string) { + this.string = string; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o; + return Objects.equals(string, fooGetDefaultResponse.string); + } + + @Override + public int hashCode() { + return Objects.hash(string); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FooGetDefaultResponse {\n"); + + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FormatTest.java new file mode 100644 index 00000000000..560b251c141 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/FormatTest.java @@ -0,0 +1,515 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.File; +import java.math.BigDecimal; +import java.util.Date; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * FormatTest + */ +@JsonPropertyOrder({ + FormatTest.JSON_PROPERTY_INTEGER, + FormatTest.JSON_PROPERTY_INT32, + FormatTest.JSON_PROPERTY_INT64, + FormatTest.JSON_PROPERTY_NUMBER, + FormatTest.JSON_PROPERTY_FLOAT, + FormatTest.JSON_PROPERTY_DOUBLE, + FormatTest.JSON_PROPERTY_DECIMAL, + FormatTest.JSON_PROPERTY_STRING, + FormatTest.JSON_PROPERTY_BYTE, + FormatTest.JSON_PROPERTY_BINARY, + FormatTest.JSON_PROPERTY_DATE, + FormatTest.JSON_PROPERTY_DATE_TIME, + FormatTest.JSON_PROPERTY_UUID, + FormatTest.JSON_PROPERTY_PASSWORD, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FormatTest { + public static final String JSON_PROPERTY_INTEGER = "integer"; + @JsonProperty(JSON_PROPERTY_INTEGER) + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + @JsonProperty(JSON_PROPERTY_INT32) + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + @JsonProperty(JSON_PROPERTY_INT64) + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + @JsonProperty(JSON_PROPERTY_NUMBER) + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + @JsonProperty(JSON_PROPERTY_FLOAT) + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + @JsonProperty(JSON_PROPERTY_DOUBLE) + private Double _double; + + public static final String JSON_PROPERTY_DECIMAL = "decimal"; + @JsonProperty(JSON_PROPERTY_DECIMAL) + private BigDecimal decimal; + + public static final String JSON_PROPERTY_STRING = "string"; + @JsonProperty(JSON_PROPERTY_STRING) + private String string; + + public static final String JSON_PROPERTY_BYTE = "byte"; + @JsonProperty(JSON_PROPERTY_BYTE) + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + @JsonProperty(JSON_PROPERTY_BINARY) + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + @JsonProperty(JSON_PROPERTY_DATE) + private Date date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @JsonProperty(JSON_PROPERTY_DATE_TIME) + private Date dateTime; + + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + private UUID uuid; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @JsonProperty(JSON_PROPERTY_PASSWORD) + private String password; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) + private String patternWithDigitsAndDelimiter; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @JsonProperty(value = "integer") + @Schema(description = "") + @Min(10) @Max(100) + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @JsonProperty(value = "int32") + @Schema(description = "") + @Min(20) @Max(200) + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @JsonProperty(value = "int64") + @Schema(description = "") + + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @JsonProperty(value = "number") + @Schema(required = true, description = "") + @NotNull @Valid @DecimalMin("32.1") @DecimalMax("543.2") + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @JsonProperty(value = "float") + @Schema(description = "") + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @JsonProperty(value = "double") + @Schema(description = "") + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest decimal(BigDecimal decimal) { + this.decimal = decimal; + return this; + } + + /** + * Get decimal + * @return decimal + **/ + @JsonProperty(value = "decimal") + @Schema(description = "") + @Valid + public BigDecimal getDecimal() { + return decimal; + } + + public void setDecimal(BigDecimal decimal) { + this.decimal = decimal; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @JsonProperty(value = "string") + @Schema(description = "") + @Pattern(regexp="/[a-z]/i") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @JsonProperty(value = "byte") + @Schema(required = true, description = "") + @NotNull + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @JsonProperty(value = "binary") + @Schema(description = "") + + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public FormatTest date(Date date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @JsonProperty(value = "date") + @Schema(required = true, description = "") + @NotNull + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @JsonProperty(value = "dateTime") + @Schema(description = "") + + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @JsonProperty(value = "uuid") + @Schema(example = "72f98069-206d-4f12-9f12-3d1e525a8e84", description = "") + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty(value = "password") + @Schema(required = true, description = "") + @NotNull @Size(min=10,max=64) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public FormatTest patternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + return this; + } + + /** + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits + **/ + @JsonProperty(value = "pattern_with_digits") + @Schema(description = "A string that is a 10 digit number. Can have leading zeros.") + @Pattern(regexp="^\\d{10}$") + public String getPatternWithDigits() { + return patternWithDigits; + } + + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @return patternWithDigitsAndDelimiter + **/ + @JsonProperty(value = "pattern_with_digits_and_delimiter") + @Schema(description = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @Pattern(regexp="/^image_\\d{1,3}$/i") + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; + } + + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(integer, formatTest.integer) && + Objects.equals(int32, formatTest.int32) && + Objects.equals(int64, formatTest.int64) && + Objects.equals(number, formatTest.number) && + Objects.equals(_float, formatTest._float) && + Objects.equals(_double, formatTest._double) && + Objects.equals(decimal, formatTest.decimal) && + Objects.equals(string, formatTest.string) && + Objects.equals(_byte, formatTest._byte) && + Objects.equals(binary, formatTest.binary) && + Objects.equals(date, formatTest.date) && + Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(uuid, formatTest.uuid) && + Objects.equals(password, formatTest.password) && + Objects.equals(patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, decimal, string, _byte, binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" decimal: ").append(toIndentedString(decimal)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..eac34a18d57 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -0,0 +1,123 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * HasOnlyReadOnly + */ +@JsonPropertyOrder({ + HasOnlyReadOnly.JSON_PROPERTY_BAR, + HasOnlyReadOnly.JSON_PROPERTY_FOO +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class HasOnlyReadOnly { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + private String bar; + + public static final String JSON_PROPERTY_FOO = "foo"; + @JsonProperty(JSON_PROPERTY_FOO) + private String foo; + + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @JsonProperty(value = "bar", access = JsonProperty.Access.READ_ONLY) + @Schema(description = "") + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + + /** + * Get foo + * @return foo + **/ + @JsonProperty(value = "foo", access = JsonProperty.Access.READ_ONLY) + @Schema(description = "") + + public String getFoo() { + return foo; + } + + public void setFoo(String foo) { + this.foo = foo; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(bar, hasOnlyReadOnly.bar) && + Objects.equals(foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HealthCheckResult.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HealthCheckResult.java new file mode 100644 index 00000000000..44b7e4aff03 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/HealthCheckResult.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@Schema(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + private String nullableMessage; + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + **/ + @JsonProperty(value = "NullableMessage") + @Schema(description = "") + + public String getNullableMessage() { + return nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = nullableMessage; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MapTest.java new file mode 100644 index 00000000000..d55f3abc195 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MapTest.java @@ -0,0 +1,242 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * MapTest + */ +@JsonPropertyOrder({ + MapTest.JSON_PROPERTY_MAP_MAP_OF_STRING, + MapTest.JSON_PROPERTY_MAP_OF_ENUM_STRING, + MapTest.JSON_PROPERTY_DIRECT_MAP, + MapTest.JSON_PROPERTY_INDIRECT_MAP +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class MapTest { + public static final String JSON_PROPERTY_MAP_MAP_OF_STRING = "map_map_of_string"; + @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) + private Map> mapMapOfString = new HashMap<>(); + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String value) { + for (InnerEnum b : InnerEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_MAP_OF_ENUM_STRING = "map_of_enum_string"; + @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) + private Map mapOfEnumString = new HashMap<>(); + + public static final String JSON_PROPERTY_DIRECT_MAP = "direct_map"; + @JsonProperty(JSON_PROPERTY_DIRECT_MAP) + private Map directMap = new HashMap<>(); + + public static final String JSON_PROPERTY_INDIRECT_MAP = "indirect_map"; + @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) + private Map indirectMap = new HashMap<>(); + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @JsonProperty(value = "map_map_of_string") + @Schema(description = "") + @Valid + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @JsonProperty(value = "map_of_enum_string") + @Schema(description = "") + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @JsonProperty(value = "direct_map") + @Schema(description = "") + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @JsonProperty(value = "indirect_map") + @Schema(description = "") + + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(directMap, mapTest.directMap) && + Objects.equals(indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..88c988f8aea --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,162 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.openapitools.model.Animal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ +@JsonPropertyOrder({ + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_UUID, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_DATE_TIME, + MixedPropertiesAndAdditionalPropertiesClass.JSON_PROPERTY_MAP +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class MixedPropertiesAndAdditionalPropertiesClass { + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + private UUID uuid; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + @JsonProperty(JSON_PROPERTY_DATE_TIME) + private Date dateTime; + + public static final String JSON_PROPERTY_MAP = "map"; + @JsonProperty(JSON_PROPERTY_MAP) + private Map map = new HashMap<>(); + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @JsonProperty(value = "uuid") + @Schema(description = "") + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @JsonProperty(value = "dateTime") + @Schema(description = "") + + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @JsonProperty(value = "map") + @Schema(description = "") + @Valid + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Model200Response.java new file mode 100644 index 00000000000..0d77f06a696 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Model200Response.java @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Model for testing model name starting with number + */ +@Schema(description = "Model for testing model name starting with number") +@JsonPropertyOrder({ + Model200Response.JSON_PROPERTY_NAME, + Model200Response.JSON_PROPERTY_PROPERTY_CLASS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Model200Response { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + private Integer name; + + public static final String JSON_PROPERTY_PROPERTY_CLASS = "class"; + @JsonProperty(JSON_PROPERTY_PROPERTY_CLASS) + private String propertyClass; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(value = "name") + @Schema(description = "") + + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @JsonProperty(value = "class") + @Schema(description = "") + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(name, _200response.name) && + Objects.equals(propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelApiResponse.java new file mode 100644 index 00000000000..86de33090ad --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ModelApiResponse + */ +@JsonPropertyOrder({ + ModelApiResponse.JSON_PROPERTY_CODE, + ModelApiResponse.JSON_PROPERTY_TYPE, + ModelApiResponse.JSON_PROPERTY_MESSAGE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ModelApiResponse { + public static final String JSON_PROPERTY_CODE = "code"; + @JsonProperty(JSON_PROPERTY_CODE) + private Integer code; + + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + private String type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + @JsonProperty(JSON_PROPERTY_MESSAGE) + private String message; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @JsonProperty(value = "code") + @Schema(description = "") + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @JsonProperty(value = "type") + @Schema(description = "") + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @JsonProperty(value = "message") + @Schema(description = "") + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelFile.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelFile.java new file mode 100644 index 00000000000..825d188c0c9 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelFile.java @@ -0,0 +1,97 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Must be named `File` for test. + */ +@Schema(description = "Must be named `File` for test.") +@JsonPropertyOrder({ + ModelFile.JSON_PROPERTY_SOURCE_U_R_I +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ModelFile { + public static final String JSON_PROPERTY_SOURCE_U_R_I = "sourceURI"; + @JsonProperty(JSON_PROPERTY_SOURCE_U_R_I) + private String sourceURI; + + public ModelFile sourceURI(String sourceURI) { + this.sourceURI = sourceURI; + return this; + } + + /** + * Test capitalization + * @return sourceURI + **/ + @JsonProperty(value = "sourceURI") + @Schema(description = "Test capitalization") + + public String getSourceURI() { + return sourceURI; + } + + public void setSourceURI(String sourceURI) { + this.sourceURI = sourceURI; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelFile _file = (ModelFile) o; + return Objects.equals(sourceURI, _file.sourceURI); + } + + @Override + public int hashCode() { + return Objects.hash(sourceURI); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelFile {\n"); + + sb.append(" sourceURI: ").append(toIndentedString(sourceURI)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelList.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelList.java new file mode 100644 index 00000000000..c75279f16b4 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelList.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ModelList + */ +@JsonPropertyOrder({ + ModelList.JSON_PROPERTY_123LIST +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ModelList { + public static final String JSON_PROPERTY_123LIST = "123-list"; + @JsonProperty(JSON_PROPERTY_123LIST) + private String _123list; + + public ModelList _123list(String _123list) { + this._123list = _123list; + return this; + } + + /** + * Get _123list + * @return _123list + **/ + @JsonProperty(value = "123-list") + @Schema(description = "") + + public String get123list() { + return _123list; + } + + public void set123list(String _123list) { + this._123list = _123list; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelList _list = (ModelList) o; + return Objects.equals(_123list, _list._123list); + } + + @Override + public int hashCode() { + return Objects.hash(_123list); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelList {\n"); + + sb.append(" _123list: ").append(toIndentedString(_123list)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelReturn.java new file mode 100644 index 00000000000..8cf6a9ada74 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ModelReturn.java @@ -0,0 +1,97 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Model for testing reserved words + */ +@Schema(description = "Model for testing reserved words") +@JsonPropertyOrder({ + ModelReturn.JSON_PROPERTY_RETURN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ModelReturn { + public static final String JSON_PROPERTY_RETURN = "return"; + @JsonProperty(JSON_PROPERTY_RETURN) + private Integer _return; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @JsonProperty(value = "return") + @Schema(description = "") + + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(_return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Name.java new file mode 100644 index 00000000000..602b74931be --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Name.java @@ -0,0 +1,177 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Model for testing model name same as property name + */ +@Schema(description = "Model for testing model name same as property name") +@JsonPropertyOrder({ + Name.JSON_PROPERTY_NAME, + Name.JSON_PROPERTY_SNAKE_CASE, + Name.JSON_PROPERTY_PROPERTY, + Name.JSON_PROPERTY_123NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Name { + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + private Integer name; + + public static final String JSON_PROPERTY_SNAKE_CASE = "snake_case"; + @JsonProperty(JSON_PROPERTY_SNAKE_CASE) + private Integer snakeCase; + + public static final String JSON_PROPERTY_PROPERTY = "property"; + @JsonProperty(JSON_PROPERTY_PROPERTY) + private String property; + + public static final String JSON_PROPERTY_123NUMBER = "123Number"; + @JsonProperty(JSON_PROPERTY_123NUMBER) + private Integer _123number; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(value = "name") + @Schema(required = true, description = "") + @NotNull + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @JsonProperty(value = "snake_case", access = JsonProperty.Access.READ_ONLY) + @Schema(description = "") + + public Integer getSnakeCase() { + return snakeCase; + } + + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @JsonProperty(value = "property") + @Schema(description = "") + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public Name _123number(Integer _123number) { + this._123number = _123number; + return this; + } + + /** + * Get _123number + * @return _123number + **/ + @JsonProperty(value = "123Number", access = JsonProperty.Access.READ_ONLY) + @Schema(description = "") + + public Integer get123number() { + return _123number; + } + + public void set123number(Integer _123number) { + this._123number = _123number; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(name, name.name) && + Objects.equals(snakeCase, name.snakeCase) && + Objects.equals(property, name.property) && + Objects.equals(_123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NullableClass.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NullableClass.java new file mode 100644 index 00000000000..3e5f8220f28 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NullableClass.java @@ -0,0 +1,447 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * NullableClass + */ +@JsonPropertyOrder({ + NullableClass.JSON_PROPERTY_INTEGER_PROP, + NullableClass.JSON_PROPERTY_NUMBER_PROP, + NullableClass.JSON_PROPERTY_BOOLEAN_PROP, + NullableClass.JSON_PROPERTY_STRING_PROP, + NullableClass.JSON_PROPERTY_DATE_PROP, + NullableClass.JSON_PROPERTY_DATETIME_PROP, + NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class NullableClass extends HashMap { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + private Integer integerProp; + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + private BigDecimal numberProp; + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + private Boolean booleanProp; + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + @JsonProperty(JSON_PROPERTY_STRING_PROP) + private String stringProp; + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + @JsonProperty(JSON_PROPERTY_DATE_PROP) + private Date dateProp; + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + private Date datetimeProp; + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + private List arrayNullableProp; + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + private List arrayAndItemsNullableProp; + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + private List arrayItemsNullable; + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + private Map objectNullableProp; + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + private Map objectAndItemsNullableProp; + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + private Map objectItemsNullable = new HashMap<>(); + + public NullableClass integerProp(Integer integerProp) { + this.integerProp = integerProp; + return this; + } + + /** + * Get integerProp + * @return integerProp + **/ + @JsonProperty(value = "integer_prop") + @Schema(description = "") + + public Integer getIntegerProp() { + return integerProp; + } + + public void setIntegerProp(Integer integerProp) { + this.integerProp = integerProp; + } + + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + return this; + } + + /** + * Get numberProp + * @return numberProp + **/ + @JsonProperty(value = "number_prop") + @Schema(description = "") + @Valid + public BigDecimal getNumberProp() { + return numberProp; + } + + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = numberProp; + } + + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + return this; + } + + /** + * Get booleanProp + * @return booleanProp + **/ + @JsonProperty(value = "boolean_prop") + @Schema(description = "") + + public Boolean getBooleanProp() { + return booleanProp; + } + + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = booleanProp; + } + + public NullableClass stringProp(String stringProp) { + this.stringProp = stringProp; + return this; + } + + /** + * Get stringProp + * @return stringProp + **/ + @JsonProperty(value = "string_prop") + @Schema(description = "") + + public String getStringProp() { + return stringProp; + } + + public void setStringProp(String stringProp) { + this.stringProp = stringProp; + } + + public NullableClass dateProp(Date dateProp) { + this.dateProp = dateProp; + return this; + } + + /** + * Get dateProp + * @return dateProp + **/ + @JsonProperty(value = "date_prop") + @Schema(description = "") + + public Date getDateProp() { + return dateProp; + } + + public void setDateProp(Date dateProp) { + this.dateProp = dateProp; + } + + public NullableClass datetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + **/ + @JsonProperty(value = "datetime_prop") + @Schema(description = "") + + public Date getDatetimeProp() { + return datetimeProp; + } + + public void setDatetimeProp(Date datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null) { + this.arrayNullableProp = new ArrayList<>(); + } + this.arrayNullableProp.add(arrayNullablePropItem); + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + **/ + @JsonProperty(value = "array_nullable_prop") + @Schema(description = "") + + public List getArrayNullableProp() { + return arrayNullableProp; + } + + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null) { + this.arrayAndItemsNullableProp = new ArrayList<>(); + } + this.arrayAndItemsNullableProp.add(arrayAndItemsNullablePropItem); + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + **/ + @JsonProperty(value = "array_and_items_nullable_prop") + @Schema(description = "") + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + **/ + @JsonProperty(value = "array_items_nullable") + @Schema(description = "") + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null) { + this.objectNullableProp = new HashMap<>(); + } + this.objectNullableProp.put(key, objectNullablePropItem); + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + **/ + @JsonProperty(value = "object_nullable_prop") + @Schema(description = "") + + public Map getObjectNullableProp() { + return objectNullableProp; + } + + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null) { + this.objectAndItemsNullableProp = new HashMap<>(); + } + this.objectAndItemsNullableProp.put(key, objectAndItemsNullablePropItem); + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + **/ + @JsonProperty(value = "object_and_items_nullable_prop") + @Schema(description = "") + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public NullableClass objectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + **/ + @JsonProperty(value = "object_items_nullable") + @Schema(description = "") + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return super.equals(o) && Objects.equals(integerProp, nullableClass.integerProp) && + Objects.equals(numberProp, nullableClass.numberProp) && + Objects.equals(booleanProp, nullableClass.booleanProp) && + Objects.equals(stringProp, nullableClass.stringProp) && + Objects.equals(dateProp, nullableClass.dateProp) && + Objects.equals(datetimeProp, nullableClass.datetimeProp) && + Objects.equals(arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(objectItemsNullable, nullableClass.objectItemsNullable); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), integerProp, super.hashCode(), numberProp, super.hashCode(), booleanProp, super.hashCode(), stringProp, super.hashCode(), dateProp, super.hashCode(), datetimeProp, super.hashCode(), arrayNullableProp, super.hashCode(), arrayAndItemsNullableProp, super.hashCode(), arrayItemsNullable, super.hashCode(), objectNullableProp, super.hashCode(), objectAndItemsNullableProp, super.hashCode(), objectItemsNullable); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NumberOnly.java new file mode 100644 index 00000000000..57c721e4df1 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/NumberOnly.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * NumberOnly + */ +@JsonPropertyOrder({ + NumberOnly.JSON_PROPERTY_JUST_NUMBER +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class NumberOnly { + public static final String JSON_PROPERTY_JUST_NUMBER = "JustNumber"; + @JsonProperty(JSON_PROPERTY_JUST_NUMBER) + private BigDecimal justNumber; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @JsonProperty(value = "JustNumber") + @Schema(description = "") + @Valid + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java new file mode 100644 index 00000000000..601f0ea4b0c --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ObjectWithDeprecatedFields.java @@ -0,0 +1,189 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.model.DeprecatedObject; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ObjectWithDeprecatedFields + */ +@JsonPropertyOrder({ + ObjectWithDeprecatedFields.JSON_PROPERTY_UUID, + ObjectWithDeprecatedFields.JSON_PROPERTY_ID, + ObjectWithDeprecatedFields.JSON_PROPERTY_DEPRECATED_REF, + ObjectWithDeprecatedFields.JSON_PROPERTY_BARS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ObjectWithDeprecatedFields { + public static final String JSON_PROPERTY_UUID = "uuid"; + @JsonProperty(JSON_PROPERTY_UUID) + private String uuid; + + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + private BigDecimal id; + + public static final String JSON_PROPERTY_DEPRECATED_REF = "deprecatedRef"; + @JsonProperty(JSON_PROPERTY_DEPRECATED_REF) + private DeprecatedObject deprecatedRef; + + public static final String JSON_PROPERTY_BARS = "bars"; + @JsonProperty(JSON_PROPERTY_BARS) + private List bars; + + public ObjectWithDeprecatedFields uuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @JsonProperty(value = "uuid") + @Schema(description = "") + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public ObjectWithDeprecatedFields id(BigDecimal id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @JsonProperty(value = "id") + @Schema(description = "") + @Valid + public BigDecimal getId() { + return id; + } + + public void setId(BigDecimal id) { + this.id = id; + } + + public ObjectWithDeprecatedFields deprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + return this; + } + + /** + * Get deprecatedRef + * @return deprecatedRef + **/ + @JsonProperty(value = "deprecatedRef") + @Schema(description = "") + @Valid + public DeprecatedObject getDeprecatedRef() { + return deprecatedRef; + } + + public void setDeprecatedRef(DeprecatedObject deprecatedRef) { + this.deprecatedRef = deprecatedRef; + } + + public ObjectWithDeprecatedFields bars(List bars) { + this.bars = bars; + return this; + } + + public ObjectWithDeprecatedFields addBarsItem(String barsItem) { + if (this.bars == null) { + this.bars = new ArrayList<>(); + } + this.bars.add(barsItem); + return this; + } + + /** + * Get bars + * @return bars + **/ + @JsonProperty(value = "bars") + @Schema(description = "") + + public List getBars() { + return bars; + } + + public void setBars(List bars) { + this.bars = bars; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ObjectWithDeprecatedFields objectWithDeprecatedFields = (ObjectWithDeprecatedFields) o; + return Objects.equals(uuid, objectWithDeprecatedFields.uuid) && + Objects.equals(id, objectWithDeprecatedFields.id) && + Objects.equals(deprecatedRef, objectWithDeprecatedFields.deprecatedRef) && + Objects.equals(bars, objectWithDeprecatedFields.bars); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, id, deprecatedRef, bars); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ObjectWithDeprecatedFields {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" deprecatedRef: ").append(toIndentedString(deprecatedRef)).append("\n"); + sb.append(" bars: ").append(toIndentedString(bars)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Order.java new file mode 100644 index 00000000000..4a6c9a64d23 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Order.java @@ -0,0 +1,265 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Order + */ +@JsonPropertyOrder({ + Order.JSON_PROPERTY_ID, + Order.JSON_PROPERTY_PET_ID, + Order.JSON_PROPERTY_QUANTITY, + Order.JSON_PROPERTY_SHIP_DATE, + Order.JSON_PROPERTY_STATUS, + Order.JSON_PROPERTY_COMPLETE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Order { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + private Long id; + + public static final String JSON_PROPERTY_PET_ID = "petId"; + @JsonProperty(JSON_PROPERTY_PET_ID) + private Long petId; + + public static final String JSON_PROPERTY_QUANTITY = "quantity"; + @JsonProperty(JSON_PROPERTY_QUANTITY) + private Integer quantity; + + public static final String JSON_PROPERTY_SHIP_DATE = "shipDate"; + @JsonProperty(JSON_PROPERTY_SHIP_DATE) + private Date shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @JsonProperty(JSON_PROPERTY_STATUS) + private StatusEnum status; + + public static final String JSON_PROPERTY_COMPLETE = "complete"; + @JsonProperty(JSON_PROPERTY_COMPLETE) + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @JsonProperty(value = "id") + @Schema(description = "") + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @JsonProperty(value = "petId") + @Schema(description = "") + + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @JsonProperty(value = "quantity") + @Schema(description = "") + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @JsonProperty(value = "shipDate") + @Schema(description = "") + + public Date getShipDate() { + return shipDate; + } + + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @JsonProperty(value = "status") + @Schema(description = "Order Status") + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @JsonProperty(value = "complete") + @Schema(description = "") + + public Boolean getComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterComposite.java new file mode 100644 index 00000000000..598006a4c78 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterComposite.java @@ -0,0 +1,150 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * OuterComposite + */ +@JsonPropertyOrder({ + OuterComposite.JSON_PROPERTY_MY_NUMBER, + OuterComposite.JSON_PROPERTY_MY_STRING, + OuterComposite.JSON_PROPERTY_MY_BOOLEAN +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class OuterComposite { + public static final String JSON_PROPERTY_MY_NUMBER = "my_number"; + @JsonProperty(JSON_PROPERTY_MY_NUMBER) + private BigDecimal myNumber; + + public static final String JSON_PROPERTY_MY_STRING = "my_string"; + @JsonProperty(JSON_PROPERTY_MY_STRING) + private String myString; + + public static final String JSON_PROPERTY_MY_BOOLEAN = "my_boolean"; + @JsonProperty(JSON_PROPERTY_MY_BOOLEAN) + private Boolean myBoolean; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @JsonProperty(value = "my_number") + @Schema(description = "") + @Valid + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @JsonProperty(value = "my_string") + @Schema(description = "") + + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @JsonProperty(value = "my_boolean") + @Schema(description = "") + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(myNumber, outerComposite.myNumber) && + Objects.equals(myString, outerComposite.myString) && + Objects.equals(myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnum.java new file mode 100644 index 00000000000..ae10ef17801 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnum.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String value) { + for (OuterEnum b : OuterEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java new file mode 100644 index 00000000000..e4597c9e0aa --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumInteger.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumInteger.java new file mode 100644 index 00000000000..b851c03c716 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumInteger.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 00000000000..c5779d36bab --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,62 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java new file mode 100644 index 00000000000..18170921c85 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java @@ -0,0 +1,97 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import org.openapitools.model.OuterEnumInteger; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * OuterObjectWithEnumProperty + */ +@JsonPropertyOrder({ + OuterObjectWithEnumProperty.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class OuterObjectWithEnumProperty { + public static final String JSON_PROPERTY_VALUE = "value"; + @JsonProperty(JSON_PROPERTY_VALUE) + private OuterEnumInteger value; + + public OuterObjectWithEnumProperty value(OuterEnumInteger value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + **/ + @JsonProperty(value = "value") + @Schema(required = true, description = "") + @NotNull @Valid + public OuterEnumInteger getValue() { + return value; + } + + public void setValue(OuterEnumInteger value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o; + return Objects.equals(value, outerObjectWithEnumProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterObjectWithEnumProperty {\n"); + + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ParentWithNullable.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ParentWithNullable.java new file mode 100644 index 00000000000..5cc6567488c --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ParentWithNullable.java @@ -0,0 +1,159 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ParentWithNullable + */ +@JsonPropertyOrder({ + ParentWithNullable.JSON_PROPERTY_TYPE, + ParentWithNullable.JSON_PROPERTY_NULLABLE_PROPERTY +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildWithNullable.class, name = "ChildWithNullable"), +}) + +public class ParentWithNullable { + /** + * Gets or Sets type + */ + public enum TypeEnum { + CHILDWITHNULLABLE("ChildWithNullable"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @JsonProperty(JSON_PROPERTY_TYPE) + private TypeEnum type; + + public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty"; + @JsonProperty(JSON_PROPERTY_NULLABLE_PROPERTY) + private String nullableProperty; + + public ParentWithNullable type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @JsonProperty(value = "type") + @Schema(description = "") + + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public ParentWithNullable nullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + return this; + } + + /** + * Get nullableProperty + * @return nullableProperty + **/ + @JsonProperty(value = "nullableProperty") + @Schema(description = "") + + public String getNullableProperty() { + return nullableProperty; + } + + public void setNullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParentWithNullable parentWithNullable = (ParentWithNullable) o; + return Objects.equals(type, parentWithNullable.type) && + Objects.equals(nullableProperty, parentWithNullable.nullableProperty); + } + + @Override + public int hashCode() { + return Objects.hash(type, nullableProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParentWithNullable {\n"); + + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" nullableProperty: ").append(toIndentedString(nullableProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Pet.java new file mode 100644 index 00000000000..725761d7d04 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Pet.java @@ -0,0 +1,289 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import org.openapitools.model.Category; +import org.openapitools.model.Tag; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Pet + */ +@JsonPropertyOrder({ + Pet.JSON_PROPERTY_ID, + Pet.JSON_PROPERTY_CATEGORY, + Pet.JSON_PROPERTY_NAME, + Pet.JSON_PROPERTY_PHOTO_URLS, + Pet.JSON_PROPERTY_TAGS, + Pet.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Pet { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + private Long id; + + public static final String JSON_PROPERTY_CATEGORY = "category"; + @JsonProperty(JSON_PROPERTY_CATEGORY) + private Category category; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + private String name; + + public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; + @JsonProperty(JSON_PROPERTY_PHOTO_URLS) + private Set photoUrls = new LinkedHashSet<>(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + @JsonProperty(JSON_PROPERTY_TAGS) + private List tags; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + @JsonProperty(JSON_PROPERTY_STATUS) + private StatusEnum status; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @JsonProperty(value = "id") + @Schema(description = "") + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @JsonProperty(value = "category") + @Schema(description = "") + @Valid + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(value = "name") + @Schema(example = "doggie", required = true, description = "") + @NotNull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + if (this.photoUrls == null) { + this.photoUrls = new LinkedHashSet<>(); + } + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @JsonProperty(value = "photoUrls") + @Schema(required = true, description = "") + @NotNull + public Set getPhotoUrls() { + return photoUrls; + } + + @JsonDeserialize(as = LinkedHashSet.class) + public void setPhotoUrls(Set photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @JsonProperty(value = "tags") + @Schema(description = "") + @Valid + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @JsonProperty(value = "status") + @Schema(description = "pet status in the store") + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..8e1030db1c1 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -0,0 +1,122 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * ReadOnlyFirst + */ +@JsonPropertyOrder({ + ReadOnlyFirst.JSON_PROPERTY_BAR, + ReadOnlyFirst.JSON_PROPERTY_BAZ +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class ReadOnlyFirst { + public static final String JSON_PROPERTY_BAR = "bar"; + @JsonProperty(JSON_PROPERTY_BAR) + private String bar; + + public static final String JSON_PROPERTY_BAZ = "baz"; + @JsonProperty(JSON_PROPERTY_BAZ) + private String baz; + + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @JsonProperty(value = "bar", access = JsonProperty.Access.READ_ONLY) + @Schema(description = "") + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @JsonProperty(value = "baz") + @Schema(description = "") + + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(bar, readOnlyFirst.bar) && + Objects.equals(baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SingleRefType.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SingleRefType.java new file mode 100644 index 00000000000..342af7c5cf7 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SingleRefType.java @@ -0,0 +1,60 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets SingleRefType + */ +public enum SingleRefType { + + ADMIN("admin"), + + USER("user"); + + private String value; + + SingleRefType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SingleRefType fromValue(String value) { + for (SingleRefType b : SingleRefType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SpecialModelName.java new file mode 100644 index 00000000000..b1a919194a5 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * SpecialModelName + */ +@JsonPropertyOrder({ + SpecialModelName.JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class SpecialModelName { + public static final String JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; + @JsonProperty(JSON_PROPERTY_$_SPECIAL_PROPERTY_NAME) + private Long $specialPropertyName; + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @JsonProperty(value = "$special[property.name]") + @Schema(description = "") + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals($specialPropertyName, specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Tag.java new file mode 100644 index 00000000000..0ec0c94faf9 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/Tag.java @@ -0,0 +1,122 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * Tag + */ +@JsonPropertyOrder({ + Tag.JSON_PROPERTY_ID, + Tag.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class Tag { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + private Long id; + + public static final String JSON_PROPERTY_NAME = "name"; + @JsonProperty(JSON_PROPERTY_NAME) + private String name; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @JsonProperty(value = "id") + @Schema(description = "") + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @JsonProperty(value = "name") + @Schema(description = "") + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java new file mode 100644 index 00000000000..5a2c5f10483 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/TestInlineFreeformAdditionalPropertiesRequest.java @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * TestInlineFreeformAdditionalPropertiesRequest + */ +@JsonPropertyOrder({ + TestInlineFreeformAdditionalPropertiesRequest.JSON_PROPERTY_SOME_PROPERTY +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class TestInlineFreeformAdditionalPropertiesRequest extends HashMap { + public static final String JSON_PROPERTY_SOME_PROPERTY = "someProperty"; + @JsonProperty(JSON_PROPERTY_SOME_PROPERTY) + private String someProperty; + + public TestInlineFreeformAdditionalPropertiesRequest someProperty(String someProperty) { + this.someProperty = someProperty; + return this; + } + + /** + * Get someProperty + * @return someProperty + **/ + @JsonProperty(value = "someProperty") + @Schema(description = "") + + public String getSomeProperty() { + return someProperty; + } + + public void setSomeProperty(String someProperty) { + this.someProperty = someProperty; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = (TestInlineFreeformAdditionalPropertiesRequest) o; + return super.equals(o) && Objects.equals(someProperty, testInlineFreeformAdditionalPropertiesRequest.someProperty); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), someProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" someProperty: ").append(toIndentedString(someProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/User.java new file mode 100644 index 00000000000..c0d7e91e0a9 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/gen/java/org/openapitools/model/User.java @@ -0,0 +1,284 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_USERNAME, + User.JSON_PROPERTY_FIRST_NAME, + User.JSON_PROPERTY_LAST_NAME, + User.JSON_PROPERTY_EMAIL, + User.JSON_PROPERTY_PASSWORD, + User.JSON_PROPERTY_PHONE, + User.JSON_PROPERTY_USER_STATUS +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class User { + public static final String JSON_PROPERTY_ID = "id"; + @JsonProperty(JSON_PROPERTY_ID) + private Long id; + + public static final String JSON_PROPERTY_USERNAME = "username"; + @JsonProperty(JSON_PROPERTY_USERNAME) + private String username; + + public static final String JSON_PROPERTY_FIRST_NAME = "firstName"; + @JsonProperty(JSON_PROPERTY_FIRST_NAME) + private String firstName; + + public static final String JSON_PROPERTY_LAST_NAME = "lastName"; + @JsonProperty(JSON_PROPERTY_LAST_NAME) + private String lastName; + + public static final String JSON_PROPERTY_EMAIL = "email"; + @JsonProperty(JSON_PROPERTY_EMAIL) + private String email; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + @JsonProperty(JSON_PROPERTY_PASSWORD) + private String password; + + public static final String JSON_PROPERTY_PHONE = "phone"; + @JsonProperty(JSON_PROPERTY_PHONE) + private String phone; + + public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; + @JsonProperty(JSON_PROPERTY_USER_STATUS) + private Integer userStatus; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @JsonProperty(value = "id") + @Schema(description = "") + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @JsonProperty(value = "username") + @Schema(description = "") + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @JsonProperty(value = "firstName") + @Schema(description = "") + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @JsonProperty(value = "lastName") + @Schema(description = "") + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @JsonProperty(value = "email") + @Schema(description = "") + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @JsonProperty(value = "password") + @Schema(description = "") + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @JsonProperty(value = "phone") + @Schema(description = "") + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @JsonProperty(value = "userStatus") + @Schema(description = "User Status") + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/Bootstrap.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/Bootstrap.java new file mode 100644 index 00000000000..2661efe00d8 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/Bootstrap.java @@ -0,0 +1,50 @@ +package org.openapitools.api; + +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder; +import io.swagger.v3.oas.integration.*; +import io.swagger.v3.oas.models.*; +import io.swagger.v3.oas.models.info.*; + +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; + +public class Bootstrap extends HttpServlet { + + private static final long serialVersionUID = 20230810; + + @Override + public void init(ServletConfig config) throws ServletException { + + Info info = new Info() + .title("OpenAPI Server") + .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") + .termsOfService("") + .contact(new Contact() + .email("")) + .license(new License() + .name("Apache-2.0") + .url("https://www.apache.org/licenses/LICENSE-2.0.html")); + + OpenAPI oas = new OpenAPI(); + oas.info(info); + + SwaggerConfiguration openApiConfig = new SwaggerConfiguration() + .openAPI(oas) + .prettyPrint(true) + .resourcePackages(Stream.of("io.swagger.sample.resource").collect(Collectors.toSet())); + + try { + new JaxrsOpenApiContextBuilder() + .servletConfig(config) + .openApiConfiguration(openApiConfig) + .buildContext(true); + + } catch (OpenApiConfigurationException e) { + throw new RuntimeException(e.getMessage(), e); + } + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java new file mode 100644 index 00000000000..a82774d6957 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/AnotherFakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.AnotherFakeApiService; +import org.openapitools.api.impl.AnotherFakeApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class AnotherFakeApiServiceFactory { + private static final AnotherFakeApiService service = new AnotherFakeApiServiceImpl(); + + public static AnotherFakeApiService getAnotherFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java new file mode 100644 index 00000000000..ec8fc60d568 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.FakeApiService; +import org.openapitools.api.impl.FakeApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeApiServiceFactory { + private static final FakeApiService service = new FakeApiServiceImpl(); + + public static FakeApiService getFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java new file mode 100644 index 00000000000..00b5186b7d0 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FakeClassnameTestApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.FakeClassnameTestApiService; +import org.openapitools.api.impl.FakeClassnameTestApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeClassnameTestApiServiceFactory { + private static final FakeClassnameTestApiService service = new FakeClassnameTestApiServiceImpl(); + + public static FakeClassnameTestApiService getFakeClassnameTestApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java new file mode 100644 index 00000000000..0bbd2c3e7f5 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/FooApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.FooApiService; +import org.openapitools.api.impl.FooApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FooApiServiceFactory { + private static final FooApiService service = new FooApiServiceImpl(); + + public static FooApiService getFooApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java new file mode 100644 index 00000000000..ca0f0b65688 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.PetApiService; +import org.openapitools.api.impl.PetApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class PetApiServiceFactory { + private static final PetApiService service = new PetApiServiceImpl(); + + public static PetApiService getPetApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java new file mode 100644 index 00000000000..3d40fe8312f --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.StoreApiService; +import org.openapitools.api.impl.StoreApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class StoreApiServiceFactory { + private static final StoreApiService service = new StoreApiServiceImpl(); + + public static StoreApiService getStoreApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java new file mode 100644 index 00000000000..c4e15e4778a --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java @@ -0,0 +1,13 @@ +package org.openapitools.api.factories; + +import org.openapitools.api.UserApiService; +import org.openapitools.api.impl.UserApiServiceImpl; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class UserApiServiceFactory { + private static final UserApiService service = new UserApiServiceImpl(); + + public static UserApiService getUserApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 00000000000..b16c7a4d1bd --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,23 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class AnotherFakeApiServiceImpl extends AnotherFakeApiService { + @Override + public Response call123testSpecialTags(Client client, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java new file mode 100644 index 00000000000..434d5b06e65 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -0,0 +1,138 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import java.math.BigDecimal; +import org.openapitools.model.ChildWithNullable; +import org.openapitools.model.Client; +import java.util.Date; +import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; +import java.io.File; +import org.openapitools.model.FileSchemaTestClass; +import org.openapitools.model.HealthCheckResult; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.OuterComposite; +import org.openapitools.model.OuterObjectWithEnumProperty; +import org.openapitools.model.Pet; +import org.openapitools.model.TestInlineFreeformAdditionalPropertiesRequest; +import org.openapitools.model.User; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeBigDecimalMap(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeHttpSignatureTest(Pet pet, String query1, String header1, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterBooleanSerialize(Boolean body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterCompositeSerialize(OuterComposite outerComposite, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterNumberSerialize(BigDecimal body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterStringSerialize(String body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testBodyWithBinary(File body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testBodyWithQueryParams( @NotNull String query, User user, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testClientModel(Client client, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, FormDataBodyPart binaryBodypart, Date date, Date dateTime, String password, String paramCallback, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testGroupParameters( @NotNull Integer requiredStringGroup, @NotNull Boolean requiredBooleanGroup, @NotNull Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testInlineAdditionalProperties(Map requestBody, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testJsonFormData(String param, String param2, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testNullable(ChildWithNullable childWithNullable, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testQueryParameterCollectionFormat( @NotNull List pipe, @NotNull List ioutil, @NotNull List http, @NotNull List url, @NotNull List context, @NotNull String allowEmpty, Map language, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response uploadFileWithRequiredFile(Long petId, FormDataBodyPart requiredFileBodypart, String additionalMetadata, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java new file mode 100644 index 00000000000..677af0c3a2e --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FakeClassnameTestApiServiceImpl.java @@ -0,0 +1,23 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.Client; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeClassnameTestApiServiceImpl extends FakeClassnameTestApiService { + @Override + public Response testClassname(Client client, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java new file mode 100644 index 00000000000..bbf3e3aaf77 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/FooApiServiceImpl.java @@ -0,0 +1,23 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.FooGetDefaultResponse; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FooApiServiceImpl extends FooApiService { + @Override + public Response fooGet(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java new file mode 100644 index 00000000000..a005a2b1992 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -0,0 +1,61 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import java.io.File; +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import java.util.Set; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class PetApiServiceImpl extends PetApiService { + @Override + public Response addPet(Pet pet, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response deletePet(Long petId, String apiKey, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response findPetsByStatus( @NotNull List status, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response findPetsByTags( @NotNull Set tags, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getPetById(Long petId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updatePet(Pet pet, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updatePetWithForm(Long petId, String name, String status, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response uploadFile(Long petId, String additionalMetadata, FormDataBodyPart _fileBodypart, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java new file mode 100644 index 00000000000..06db41bac8c --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java @@ -0,0 +1,39 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import java.util.Map; +import org.openapitools.model.Order; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class StoreApiServiceImpl extends StoreApiService { + @Override + public Response deleteOrder(String orderId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getInventory(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getOrderById( @Min(1L) @Max(5L)Long orderId, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response placeOrder(Order order, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java new file mode 100644 index 00000000000..62e74c35636 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -0,0 +1,59 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import java.util.Date; +import org.openapitools.model.User; + +import java.util.List; +import org.openapitools.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataBodyPart; + +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.SecurityContext; +import jakarta.validation.constraints.*; +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class UserApiServiceImpl extends UserApiService { + @Override + public Response createUser(User user, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response createUsersWithArrayInput(List user, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response createUsersWithListInput(List user, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response deleteUser(String username, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getUserByName(String username, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response loginUser( @NotNull String username, @NotNull String password, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response logoutUser(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updateUser(String username, User user, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey3/src/main/webapp/WEB-INF/web.xml b/samples/server/petstore/jaxrs/jersey3/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..eda093c229c --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey3/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,44 @@ + + + + + jersey + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + + io.swagger.v3.jaxrs2.integration.resources, + org.openapitools.api + + + + jersey.config.server.provider.classnames + org.glassfish.jersey.media.multipart.MultiPartFeature + + + jersey.config.server.wadl.disableWadl + true + + 1 + + + + Bootstrap + org.openapitools.api.Bootstrap + 2 + + + jersey + /v2/* + + + ApiOriginFilter + org.openapitools.api.ApiOriginFilter + + + ApiOriginFilter + /* + +