Open cdestombes opened 3 years ago
Hi @cdestombes please submit a PR, with the test case and proposed solution, so we can review.
Thanks!
Hi, sorry for long delay before reply. I was busy on other projects.
I juste create a PR https://github.com/swagger-api/swagger-parser/pull/1575 for build on Windows with changes proposed initialy. I wasn't able to fix all tests problems for build on Windows. Two tests still failed :
For both tests, the failed is on :
assertTrue(definitions.containsKey("greeting-message"));
I don't understood why this key is expected. Should be came from filename ? I don't see any element "greeting-message" in yaml.
On Windows for swagger-parver-v3 v2.0.24, we have StringIndexOutOfBoundsException for relative $ref like
$ref: './path/file.yaml#/components/schemas/Type'
Parsing problem is on ExternalRefProcessor.processRefToExternalSchema at line 113
String parent = file.substring(0, file.lastIndexOf(File.separatorChar));
I don't think that OS specific separator need to be use here. In yaml, all paths are with '/' no ? I think only lastIndexOf '/' is needed :
String parent = file.substring(0, file.lastIndexOf('/'));
But after this change, we have other problem on :
schemaFullRef = Paths.get(parent, schemaFullRef).normalize().toString();
After normalise relative in file part "#/components/schemas/Type" is also convert to :
path\file.yaml#\components\schemas\Type
I made some change for adjust that with :
This changes made build OK on Windows and Linux but I'm not sure to cover all case. Someone see a better approch for a PR ?