Error: Mapping key must be a string scalar rather than number
See original GitHub issueLooking for a way to turn off that error caused by OAS response code keys that the linter interprets as numbers. It’s kind of misleading, and in large specs it produces a lot of useless report lines. I can’t find anything in docs about disabling the errors generated by parser
.
petstore.txt linter_report.txt
Thanks
P.S. Looks like key validation logic was recently introduced in @spectral/yaml in https://github.com/stoplightio/yaml/commit/2712bee8ef672127ade17c3d6d17a9771383f532 and the workaround is to roll back to 3.4.0 version of @spectral/yaml.
Issue Analytics
- State:
- Created 4 years ago
- Comments:20 (7 by maintainers)
Top Results From Across the Web
"Mapping keys are not allowed here" when I use '?' character ...
I use yaml with Java and I have an error in Eclipse at the line with - name: fileA . Does exist a...
Read more >"Error using save Must be a string scalar or character vector."
But I need to be able to change the filename within the loop, hence why I'm doing it the first way. When I...
Read more >Node - Parsed YAML configuration - BuildStream documentation
ScalarNode : represents a YAML Scalar (string, boolean, integer) ... Use Node.from_dict() instead, which will ensure your node is correctly formatted.
Read more >The YAML Format (Symfony Docs)
In a mapping, a key can be any valid scalar. The number of spaces between the colon and the value does not matter:...
Read more >GraphQL specification
3.5.1Int; 3.5.2Float; 3.5.3String; 3.5.4Boolean; 3.5.5ID; 3.5.6Scalar Extensions ... Instead, application servers take their capabilities and map them to a ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am not using JSON so I frankly don’t care if it does not support numbers as keys. If I would convert yaml to json, I am pretty sure the tool used to do that would handle such cases.
So if YAML supports numeric keys, this rule should be made rather optional or dependant on the source file type.
I agree with @pkuczynski: ideally, valid OpenAPI YAML would not be throwing these errors.