diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 24f407c08a55..e10000f981d7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -1433,6 +1433,11 @@ public class DefaultGenerator implements Generator { } } + private Path absPath(File input) { + // intentionally creates a new absolute path instance, disconnected from underlying FileSystem provider of File + return java.nio.file.Paths.get(input.getAbsolutePath()); + } + /** * Generates a file at .openapi-generator/FILES to track the files created by the user's latest run. * This is ideal for CI and regeneration of code without stale/unused files from older generations. @@ -1443,7 +1448,7 @@ public class DefaultGenerator implements Generator { if (generateMetadata) { try { StringBuilder sb = new StringBuilder(); - File outDir = new File(this.config.getOutputDir()); + Path outDir = absPath(new File(this.config.getOutputDir())); List filesToSort = new ArrayList<>(); @@ -1452,7 +1457,7 @@ public class DefaultGenerator implements Generator { // We have seen NPE on CI for getPath() returning null, so guard against this (to be fixed in 5.0 template management refactor) //noinspection ConstantConditions if (f != null && f.getPath() != null) { - filesToSort.add(f); + filesToSort.add(outDir.relativize(absPath(f)).normalize().toFile()); } }); @@ -1461,13 +1466,12 @@ public class DefaultGenerator implements Generator { String relativeMeta = METADATA_DIR + "/VERSION"; filesToSort.sort(PathFileComparator.PATH_COMPARATOR); filesToSort.forEach(f -> { - String tmp = outDir.toPath().relativize(f.toPath()).normalize().toString(); // some Java implementations don't honor .relativize documentation fully. // When outDir is /a/b and the input is /a/b/c/d, the result should be c/d. // Some implementations make the output ./c/d which seems to mix the logic // as documented for symlinks. So we need to trim any / or ./ from the start, // as nobody should be generating into system root and our expectation is no ./ - String relativePath = removeStart(removeStart(tmp, "." + File.separator), File.separator); + String relativePath = removeStart(removeStart(f.toString(), "." + File.separator), File.separator); if (File.separator.equals("\\")) { // ensure that windows outputs same FILES format relativePath = relativePath.replace(File.separator, "/"); diff --git a/samples/client/petstore/ada/.openapi-generator/FILES b/samples/client/petstore/ada/.openapi-generator/FILES new file mode 100644 index 000000000000..476daf7c2ffe --- /dev/null +++ b/samples/client/petstore/ada/.openapi-generator/FILES @@ -0,0 +1,8 @@ +config.gpr +src/client/samples-petstore-clients.adb +src/client/samples-petstore-clients.ads +src/model/samples-petstore-models.adb +src/model/samples-petstore-models.ads +src/samples-petstore-client.adb +src/samples-petstore.ads +src/samples.ads diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/.openapi-generator/FILES index 7f11560dda7f..7f8ebffb302f 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/.openapi-generator/FILES @@ -11,9 +11,9 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts variables.ts diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/.openapi-generator/FILES index 7f11560dda7f..7f8ebffb302f 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/.openapi-generator/FILES @@ -11,9 +11,9 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts variables.ts diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/.openapi-generator/FILES index 7f11560dda7f..7f8ebffb302f 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/.openapi-generator/FILES @@ -11,9 +11,9 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts variables.ts diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/.openapi-generator/FILES index 7f11560dda7f..7f8ebffb302f 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/.openapi-generator/FILES @@ -11,9 +11,9 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts variables.ts diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/.openapi-generator/FILES index 7f11560dda7f..7f8ebffb302f 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/.openapi-generator/FILES @@ -11,9 +11,9 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts variables.ts diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/.openapi-generator/FILES index 7f11560dda7f..7f8ebffb302f 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/.openapi-generator/FILES @@ -11,9 +11,9 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts variables.ts diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/.openapi-generator/FILES b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/.openapi-generator/FILES index d85eeefc6f26..5db7bd763695 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/.openapi-generator/FILES @@ -11,11 +11,11 @@ git_push.sh index.ts model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts ng-package.json package.json tsconfig.json diff --git a/samples/client/petstore/typescript-node/default/.openapi-generator/FILES b/samples/client/petstore/typescript-node/default/.openapi-generator/FILES index ff52c7c5b2b8..78263e8c1901 100644 --- a/samples/client/petstore/typescript-node/default/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-node/default/.openapi-generator/FILES @@ -7,8 +7,8 @@ api/userApi.ts git_push.sh model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts diff --git a/samples/client/petstore/typescript-node/npm/.openapi-generator/FILES b/samples/client/petstore/typescript-node/npm/.openapi-generator/FILES index d24a1934784b..e69a0c8e226f 100644 --- a/samples/client/petstore/typescript-node/npm/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-node/npm/.openapi-generator/FILES @@ -7,10 +7,10 @@ api/userApi.ts git_push.sh model/apiResponse.ts model/category.ts +model/models.ts model/order.ts model/pet.ts model/tag.ts model/user.ts -model/models.ts package.json tsconfig.json diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/.openapi-generator/FILES b/samples/server/petstore/php-symfony/SymfonyBundle-php/.openapi-generator/FILES index 8c41d6e8cf56..52c184ea4ba4 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/.openapi-generator/FILES +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/.openapi-generator/FILES @@ -1,3 +1,7 @@ +.coveralls.yml +.gitignore +.php_cs.dist +.travis.yml Api/ApiServer.php Api/PetApiInterface.php Api/StoreApiInterface.php @@ -6,27 +10,14 @@ Controller/Controller.php Controller/PetController.php Controller/StoreController.php Controller/UserController.php +DependencyInjection/Compiler/OpenAPIServerApiPass.php +DependencyInjection/OpenAPIServerExtension.php Model/ApiResponse.php Model/Category.php Model/Order.php Model/Pet.php Model/Tag.php Model/User.php -Service/JmsSerializer.php -Service/SerializerInterface.php -Service/StrictJsonDeserializationVisitor.php -Service/SymfonyValidator.php -Service/TypeMismatchException.php -Service/ValidatorInterface.php -Tests/AppKernel.php -Tests/Controller/ControllerTest.php -Tests/test_config.yml -.coveralls.yml -.gitignore -.php_cs.dist -.travis.yml -DependencyInjection/Compiler/OpenAPIServerApiPass.php -DependencyInjection/OpenAPIServerExtension.php OpenAPIServerBundle.php README.md Resources/config/routing.yml @@ -40,6 +31,15 @@ Resources/docs/Model/Order.md Resources/docs/Model/Pet.md Resources/docs/Model/Tag.md Resources/docs/Model/User.md +Service/JmsSerializer.php +Service/SerializerInterface.php +Service/StrictJsonDeserializationVisitor.php +Service/SymfonyValidator.php +Service/TypeMismatchException.php +Service/ValidatorInterface.php +Tests/AppKernel.php +Tests/Controller/ControllerTest.php +Tests/test_config.yml autoload.php composer.json git_push.sh