Bug: validateMimeTypeOAS3 error - `allowedValues` is not provided for `request-mime-type` rule
See original GitHub issueDescribe the bug
when I use lint extends all
I’m getting an error for allowedValues
is not provided for request-mime-type
rule. If I change the config to recommended
the linter succeeds.
To Reproduce Steps to reproduce the behavior:
- Given this
.redocly.yaml
file (below) - And this OpenAPI file(s)
- Run this command with these arguments…
openapi lint ./my-swagger.yaml --format stylish
- See error
Expected behavior the linter should produce an error for the missing mime-type and define where it should be included in the spec.
Logs
openapi lint ./my-swagger.yaml --format stylish
validating ./my-swagger.yaml...
Something went wrong when processing ./my-swagger.yaml:
- Parameter "allowedValues" is not provided for "request-mime-type" rule.
(node:28796) UnhandledPromiseRejectionWarning: Error: Parameter "allowedValues" is not provided for "request-mime-type" rule
at Object.validateMimeTypeOAS3 (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\utils.js:111:15)
at leave (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\rules\oas3\request-mime-type.js:10:29)
at visitWithContext (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:205:13)
at walkNode (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:177:21)
at walkNode (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:154:25)
at walkNode (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:154:25)
at walkNode (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:154:25)
at walkNode (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:154:25)
at Object.walkDocument (C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\walk.js:32:5)
at C:\Users\fiel\.nvm\versions\node\v14.18.1\bin\node_modules\@redocly\openapi-cli\node_modules\@redocly\openapi-core\lib\lint.js:64:16
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
OpenAPI definition
If applicable, add an OpenAPI definition and .redocly.yaml
configuration file that helps reproduce the problem.
At a minimum, please state the specification version(s) you’re using (e.g. 2.0, 3.0, 3.1).
openapi: 3.0.0
info:
version: '1.1'
title: 'an api'
description: ' a description.'
contact:
name: 'Jeremy'
email: 'jeremy@me.com'
servers:
- url: 'http://api.redocly.com'
paths:
/v1/endpoint:
post:
summary: 'this is a summary'
description: 'this is a description'
operationId: createRecord
tags:
- createRecord
parameters:
- $ref: '#/components/parameters/customerTransactionId'
- $ref: '#/components/parameters/clientId'
- $ref: '#/components/parameters/locale'
- $ref: '#/components/parameters/establishedId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/component_1'
lint:
extends:
- all
rules:
info-license: off
info-license-url: off
operation-tag-defined: off
tag-description: off
openapi-cli
Version(s)
1.0.0-beta.69
Node.js
Version(s)
v14.18.1
Additional context relates to #422
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Misleading error message claiming allowed values in "in" of a ...
If I just complete the parameter definition by providing it's schema, this error is not reported, although the value for "in" is still...
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
@tatomyr You can hide my comment or mark it as off-topic. After struggling with this for a bit my colleague that set up redocly-cli on our repo showed me that we actually have 4 different config files. 😄 We have 4 different configs we need to run with. I changed one that wasn’t being called in our normal build. If I change the correct config file then the problem does disappear as mentioned above.
We are having fun trying to figure out how to upgrade from @redocly/openapi-cli": "^1.0.0-beta.63, but I just discovered that with
recommended
everything seems to work fine.@adamaltman I agree.