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.

Json Spec files should output spaces instead of tabs

See original GitHub issue

Sorting

  • I’m submitting a …

    • [ X] bug report
    • feature request
    • support request
  • I confirm that I

    • [ X] used the search to make sure that a similar issue hasn’t already been submit

Expected Behavior

Spec files should not have tabs (json files specifically tested). Using ‘npx @stoplight/spectral lint --verbose ./src/swagger/openapi.json’ should NOT return ‘warning parser Using tabs can lead to unpredictable results’

Current Behavior

Using ‘npx @stoplight/spectral lint --verbose ./src/swagger/openapi.json’ returns ‘warning parser Using tabs can lead to unpredictable results’

Possible Solution

on line 42 of the following snippet

let data = JSON.stringify(spec, null, '\t');

https://github.com/lukeautry/tsoa/blob/fd1915f9506e9cff8368a2c2cc404bc8336e668c/packages/cli/src/module/generate-spec.ts#L42-L45

replace the ‘/t’ with 2 or 4

Steps to Reproduce

Generate a spec with version 3.5.2 Using npx @stoplight/spectral lint --verbose ./src/swagger/openapi.json

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

2reactions
RBornostcommented, Mar 20, 2021

I am not sure about the JSON spec. But how I discovered this “problem” is following the TSOA docs. In them it mentions using stoplight/spectrum to validate the Open Api file. In doing so it outputs thousands of lines of warnings regarding the tabs. The “rule” cannot be turned off as it considers it a parsing error. Effectively hiding all other warnings.

0reactions
gitizenmecommented, Aug 24, 2021

👍 would like this to be implemented

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to indent as spaces instead of tab?
I tried shiftwidth=2 , tabstop=2 , but no matter what, it's still indents using tabs instead of spacebar, which causes the JADE compile...
Read more >
What is the JSON indentation level convention? - Stack Overflow
Should it be 2 spaces, 3 spaces, 4 spaces, tabs delimited, or something else? I tried to come across the official JSON site,...
Read more >
Developers Who Use Spaces Make More Money Than Those ...
The model estimated that using spaces instead of tabs is associated with an 8.6% higher ... Who would choose to have their files...
Read more >
Unflatten from JSON does not like tab character (\t, 0x09)
Solved: Getting error -375003 when running the attached VI. The string in the control has a tab character (\t) after the letters "AFE"....
Read more >
JSON - Wikipedia
JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of ......
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