-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema Required property check no longer working #1751
Comments
Similar problem here too.
Spectral is complaining in Stoplight that IF the defnition uses a lowercase u for User, the problem does not appear. I can see in the example above, the schema is using I believe something is testing a variable with out accounting for case-sensitivity |
Alex, use a triple backtick on its own line for a code block opening (and closing), so the markdown doesn't pull out the \n from your YAML |
I found the issue in my case In our YAML (3000+ lines) there was a pointer to the schema |
Hello Guys, I'm facing the same problem, do you have any updates about the resolution? if yes, can you show an example of your valid schema? |
Is there any workaround? I use this rule to check that I don't forget to rename required properties when I fix case issues: must-use-snake-case-for-required-property-names:
message: Required property name has to be ASCII snake_case
severity: error
given: $.paths.*.*[responses,requestBody]..content..schema..required.*
then:
function: pattern
functionOptions:
match: ^[a-z_][a-z_0-9]*$ |
Here is a complete example. Could you please fix this issue? It is quite annoying. openapi: "3.0.0"
info:
title: Example
version: 2.0.0
contact:
email: [email protected]
description: default
servers:
- url: "https://default.com/v1"
description: "Development server"
tags:
- name: user
paths:
/users:
get:
operationId: get_users
x-openapi-router-controller: project.controllers.user_controller
tags:
- user
description: get user
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
# schema:
# $ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
required:
- id # unknown field
- description # unknown field
properties:
name:
description: name
type: string
example: 'Pathloss' |
I am running spectral 5.8.1 and given the following schema:
schemas: Car: type: object required: - id - manufacturerName properties: id: description: The ID of the car type: string example: 'a123-4d567-c123' manufacturName: description: The name of the manufacturer type: string example: Ford
spectral is not complaining that required property manufacturerName is missing (typoed) It DOES error IF this schema is used as part of an array and a top level schema example doesnt have the property but not at this level. I am sure this worked before but does no longer show via the CLI or VS code plugin.
Full def is here if you want it https://app.swaggerhub.com/apis/AdvancedComputerSoft/demo-advanced-car-inventory/1.0.0#/Car
The text was updated successfully, but these errors were encountered: