question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Mapping key must be a string scalar rather than number

See original GitHub issue

Looking 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:closed
  • Created 4 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
pkuczynskicommented, Feb 20, 2020

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.

1reaction
andrei572commented, Feb 21, 2020

I agree with @pkuczynski: ideally, valid OpenAPI YAML would not be throwing these errors.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found