Skip to content
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

"While scanning a multi-line double-quoted scalar, found wrong indentation." on valid yaml file #486

Closed
eriksteinebach opened this issue Sep 20, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@eriksteinebach
Copy link

Describe the bug
I am trying to generate a client with the following command:
refitter "https://docs.contentcontroller.com/automation-api/v1/cc-public-api.yml" --skip-validation --namepsace "Rustici.GeneratedCode"

When I use the following tool: https://onlineyamltools.com/validate-yaml to validate the yaml, everything seems valid.

But when I run the command I get the following error:

Error: While scanning a multi-line double-quoted scalar, found wrong indentation. Exception: YamlDotNet.Core.SyntaxErrorException Stack Trace: at YamlDotNet.Core.Scanner.ScanFlowScalar(Boolean isSingleQuoted) at YamlDotNet.Core.Scanner.FetchQuotedScalar(Boolean isSingleQuoted) at YamlDotNet.Core.Scanner.FetchNextToken() at YamlDotNet.Core.Scanner.FetchMoreTokens() at YamlDotNet.Core.Scanner.MoveNextWithoutConsuming() at YamlDotNet.Core.Parser.GetCurrentToken() at YamlDotNet.Core.Parser.ParseBlockMappingValue() at YamlDotNet.Core.Parser.MoveNext() .... at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type) at NSwag.OpenApiYamlDocument.FromYamlAsync(String data, String documentPath, SchemaType expectedSchemaType, Func_2 referenceResolverFactory, CancellationToken cancellationToken) at Refitter.Core.OpenApiDocumentFactory.CreateUsingNSwagAsync(String openApiPath) in /_/src/Refitter.Core/OpenApiDocumentFactory.cs:line 50 at Refitter.Core.OpenApiDocumentFactory.CreateAsync(String openApiPath) in /_/src/Refitter.Core/OpenApiDocumentFactory.cs:line 41 at Refitter.Core.RefitGenerator.GetOpenApiDocument(RefitGeneratorSettings settings) in /_/src/Refitter.Core/RefitGenerator.cs:line 35 at Refitter.Core.RefitGenerator.CreateAsync(RefitGeneratorSettings settings) in /_/src/Refitter.Core/RefitGenerator.cs:line 19 at Refitter.GenerateCommand.ExecuteAsync(CommandContext context, Settings settings) in /_/src/Refitter/GenerateCommand.cs:line 45

Support Key: tb7axxy

OpenAPI Specifications
https://docs.contentcontroller.com/automation-api/v1/cc-public-api.yml

Additional context
I am new to all of this, so it is very possible I just did something stupid myself. And the OpenApi document was not generated by myself, but by another company, so maybe there is something wrong there. I am just not able to figure out what this issue is and would appreciate the help.

@eriksteinebach eriksteinebach added the bug Something isn't working label Sep 20, 2024
@christianhelle
Copy link
Owner

@eriksteinebach Thanks for taking the time to report this. I'll see what I can do

@christianhelle
Copy link
Owner

@eriksteinebach I couldn't get the linked OpenAPI specifications to work as is, but when I re-format it to use single quotes with https://jsonformatter.org/yaml-validator then Refitter stopped complaining and was able to generate code

Here a zip file containing both the re-formatted YAML file and the Refitter output file
Archive.zip

@christianhelle
Copy link
Owner

I use NSwag for parsing the OpenAPI specifications document, and it seems that the library doesn't like the OpenAPI specifications that you shared

There is not much I can do about that, and since there's an easy workaround I don't think I'll spend time investigating how the problem in the NSwag code base either

@eriksteinebach
Copy link
Author

@christianhelle thank you for looking into this. With a couple of other small tweaks I was able to generate the interface, so I think it works. Yes, it looks like more a problem in NSwag. But I can continue for now, so I will leave this be as well.

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants