Skip to content
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

Weird spectral parsing output #397

Closed
nulltoken opened this issue Jul 20, 2019 · 3 comments
Closed

Weird spectral parsing output #397

nulltoken opened this issue Jul 20, 2019 · 3 comments
Labels
t/bug Something isn't working

Comments

@nulltoken
Copy link
Contributor

Describe the bug

Following yaml seems weirdly parsed by Spectral

To Reproduce

repro/output.openapi.yaml

openapi: 3.0.0
servers:
  - url: "https://ex-ample.com"
x-format-version: "1.0"
info:
  title: Five
  description: Issue repro 5
  contact:
    email: [email protected]
  version: 0.0.0
paths: {}
components:
  schemas:
    AModel:
      description: Yet another self descriptive explanation
      type: object
      required:
        - identifier
      properties:
        identifier:
          type: string
        a_date:
          description: a date
          type: date
          example: 2020-05-11

Run

$ yarn spectral lint repro/output.openapi.yaml -o repro/log.txt -f json -q
yarn run v1.15.2
 C:\REDACTED\node_modules\.bin\spectral lint repro/output.openapi.yaml -o repro/log.txt -f json -q
Encountered error when running rule 'valid-example' on node at path '$,components,schemas,AModel,properties,a_date':
Error: schema is invalid: data/type should be equal to one of the allowed values, data/type should be array, data/type should match some schema in
anyOf
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

repro/log.txt

[
	{
		"code": "oas3-schema",
		"path": [
			"components",
			"schemas",
			"AModel"
		],
		"message": "/components/schemas/AModel should have required property '$ref'",
		"severity": 0,
		"range": {
			"start": {
				"line": 24,
				"character": 11
			},
			"end": {
				"line": 35,
				"character": 29
			}
		},
		"source": "repro/output.openapi.yaml"
	}
]

Expected behavior

  • Nothing in stderr/stdout
  • Log should contain an error about unknown date type
  • Log should not contain the error /components/schemas/AModel should have required property '$ref' (which wording seems a tad weird ;-) )

Environment (remove any that are not applicable):

  • Library version: 4.0.1
  • OS: Windows 7
@nulltoken nulltoken added the t/bug Something isn't working label Jul 20, 2019
@nulltoken
Copy link
Contributor Author

Hey! Have you had the time to review/triage this?

@philsturgeon
Copy link
Contributor

This should be resolved with the greater work being done in #243, but progress has halted. Valid examples are complex. I will try and get somebody to work on this soon.

@philsturgeon
Copy link
Contributor

Closing as this is half #243 and half #403.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants