-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core][bug] FILES is now path relative with no prefixes #7271
Conversation
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 ./ This resolves regeneration issues for those on such Java implementations, although we've not been able to track down the exact vendor or configurations which might lead to these differences.
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Yes, I see this problem when generating the samples in my local workspace (but not in CI). I'll apply your changes to my branch now to check. |
@sebastien-rosset I appreciate it. I noticed another issue related to FILES on Windows while fixing the cross-version check, and pushed a fix for this to this PR around the time of your comment. I think you said you were on Mac, but just wanted to give a heads just in case. |
I'm building in a CentOS Linux VM. |
I pulled your branch into my local branch, ran # modified: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-node/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-node/npm/.openapi-generator/FILES
# modified: samples/server/petstore/python-blueplanet/.openapi-generator/FILES index bc66e2a..7f11560 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
@@ -9,11 +9,11 @@ configuration.ts
encoder.ts
git_push.sh
index.ts
-model/./apiResponse.ts
-model/./category.ts
-model/./order.ts
-model/./pet.ts
-model/./tag.ts
-model/./user.ts
+model/apiResponse.ts
+model/category.ts
+model/order.ts
+model/pet.ts
+model/tag.ts
+model/user.ts
model/models.ts
variables.ts |
This is what I did: git merge --no-commit --squash upstream/fix-relative-path-in-files-cache
git status
# On branch add-model-cache
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
# modified: samples/server/petstore/php-symfony/SymfonyBundle-php/.openapi-generator/FILES
mvn package
bin/generate-samples.sh
git status
On branch add-model-cache
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java
# modified: samples/server/petstore/php-symfony/SymfonyBundle-php/.openapi-generator/FILES
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-node/default/.openapi-generator/FILES
# modified: samples/client/petstore/typescript-node/npm/.openapi-generator/FILES
# modified: samples/server/petstore/python-blueplanet/.openapi-generator/FILES
I do see your changes in my branch (uncommitted). |
@sebastien-rosset the green in your diff is the new changes correct? If so, then it looks like it's working as expected. Or did I misunderstand your response? |
ah ok, yes. So you didn't run |
@sebastien-rosset no, I did. There was only one change on my branch in a php file. Yours and mine might have different merge bases and the changes you're seeing maybe l may have been fixed already in latest master, or you might have those changes from an earlier commit of yours. CI on this branch is also looking good. I've been trying to determine if it's a specific version of Java causing this, but wasn't able to find one that's faulty. I did try ubuntu, alpine, and centos so I'm not sure it's caused by the OS. |
Wait, that's weird. So I do see the Based on your diff, it seems like that functionality might be random and only for a handful of generators? I'd need to dig into that one a little more to resolve the issue in the middle of the paths. |
Should we call java.nio.normalize? |
Yeah. Let me try that and see if it solves the problem. Everything outside of this call works off File or Path, so it's a little weird that it's happening here. It must be that some generators are embedding |
@sebastien-rosset normalize seems to do the trick. I'll go ahead and merge once CI completes successfully. I'm still curious why this occurs seemingly randomly (such as your diff above). Thanks for testing it out and recommending the normalize operation for the mid-path fix. |
* master: (720 commits) [docs] Update README badges (#7276) Update apiInvoker.mustache and sample file for akka-scala client for issue #7258 fix (#7259) [Dart] Get all enum values in a list (#7166) Update .gitattributes [ci] Set ubuntu workflow verification to autoclrf=true, safeclrf=false Update check-supported-versions.yaml [ci] Update gitattributes and allow skipping docs generation for Windows CI workflows (#7273) [core][bug] FILES is now path relative with no prefixes (#7271) Update check-supported-versions.yaml Update check-supported-versions.yaml (#7268) [Java][jersey2] Add jersey injection dependencies (#7240) [C][Clang Static Analyzer] Remove the useless variable when assembling URL (#7255) Date format dart (#6389) minor enhancement to java client generator (#7253) typescript: Fix Union Types Import Issue (#6789) Modifying the es5 and es6 templates for javascript to handle default values (#6649) [python-exp] simplify examples (#7157) Support for KumuluzEE microprofile runtime (#5944) [C#][netcore] minor improvements and bug fixes (#7244) Deprecate Flash (ActionScript) client generator (#7231) ...
* master: (219 commits) [java] Appropriate instantiation of model with dynamic properties (OpenAPITools#6052) [docs] Update README badges (OpenAPITools#7276) Update apiInvoker.mustache and sample file for akka-scala client for issue OpenAPITools#7258 fix (OpenAPITools#7259) [Dart] Get all enum values in a list (OpenAPITools#7166) Update .gitattributes [ci] Set ubuntu workflow verification to autoclrf=true, safeclrf=false Update check-supported-versions.yaml [ci] Update gitattributes and allow skipping docs generation for Windows CI workflows (OpenAPITools#7273) [core][bug] FILES is now path relative with no prefixes (OpenAPITools#7271) Update check-supported-versions.yaml Update check-supported-versions.yaml (OpenAPITools#7268) [Java][jersey2] Add jersey injection dependencies (OpenAPITools#7240) [C][Clang Static Analyzer] Remove the useless variable when assembling URL (OpenAPITools#7255) Date format dart (OpenAPITools#6389) minor enhancement to java client generator (OpenAPITools#7253) typescript: Fix Union Types Import Issue (OpenAPITools#6789) Modifying the es5 and es6 templates for javascript to handle default values (OpenAPITools#6649) [python-exp] simplify examples (OpenAPITools#7157) Support for KumuluzEE microprofile runtime (OpenAPITools#5944) [C#][netcore] minor improvements and bug fixes (OpenAPITools#7244) ...
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 ./
This resolves regeneration issues for those on such Java
implementations, although we've not been able to track down the exact
vendor or configurations which might lead to these differences.
cc @OpenAPITools/generator-core-team
cc @sebastien-rosset I believe you were affected by this FILES issue? If so, would you mind checking against this branch to see if it's resolved?
PR checklist
./bin/generate-samples.sh
to update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH.master