Skip to content

Fix some linter issues - #40

Merged
k0kubun merged 3 commits into
exoego:masterfrom
blocknotes:fix-openapi-linter-issues
Mar 19, 2022
Merged

Fix some linter issues#40
k0kubun merged 3 commits into
exoego:masterfrom
blocknotes:fix-openapi-linter-issues

Conversation

@blocknotes

@blocknotes blocknotes commented Mar 18, 2022

Copy link
Copy Markdown

Hey :)

Checking with @redocly/openapi-cli linter I get some errors:

  • Expected type string but got null related to the tags key when an empty value is exported;
  • Operation object summary must be non-empty string. related to the summary key when an empty value is exported.

This PR is a proposal for minor improvements.

Please let me know your opinion.

@blocknotes blocknotes changed the title Fix openapi linter issues Fix some linter issues Mar 18, 2022
@k0kubun

k0kubun commented Mar 18, 2022

Copy link
Copy Markdown
Collaborator

Could we possibly add tests for this thing?

@blocknotes

Copy link
Copy Markdown
Author

Could we possibly add tests for this thing?

Ok, if you run the spec only with the first commit (Add a test with a block route) you get this error:

# bundle exec rspec

         1) Extra routes #test_block returns the block content
            Failure/Error: tags = [route.requirements[:controller].classify]

            NoMethodError:
              undefined method `classify' for nil:NilClass
            # ./lib/rspec/openapi/record_builder.rb:24:in `build'
            # ./lib/rspec/openapi/hooks.rb:14:in `block in <top (required)>'

If you run the spec on the second commit (Skip empty tags and fix routes without a Rails controller) it will produce an OpenAPI YAML with an empty summary.

I removed the last commit (When a route is not found print a warning in place of an exception) to make some extra checks.

@blocknotes
blocknotes marked this pull request as ready for review March 18, 2022 21:58
Mattia Roccoberton added 3 commits March 18, 2022 23:00
Fix linter error:

Operation object `summary` must be non-empty string.

 9 | "/api/v1/posts":
10 |   get:
11 |     summary: ''
12 |     tags:
13 |     -

Error was generated by the operation-summary rule.
@k0kubun
k0kubun merged commit 00cd0b0 into exoego:master Mar 19, 2022
@blocknotes
blocknotes deleted the fix-openapi-linter-issues branch March 20, 2022 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants