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

Adding propertyNames to json schema failes speccy #293

Open
svrnwnsch opened this issue Feb 15, 2019 · 1 comment
Open

Adding propertyNames to json schema failes speccy #293

svrnwnsch opened this issue Feb 15, 2019 · 1 comment

Comments

@svrnwnsch
Copy link

Detailed description

I found a bug: I added as a response schema with $ref the following json schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "propertyNames": {
    "enum": ["Key1", "Key2"]
  }
}

I got the entry for propertyNames from this stackoverflow question.

When I start speccy via speccy serve openapi/index.openapi.yml -j --verbose it fails with:

GET /path-to-json/seeabove.json #
Expected object or boolean as schema, got array
Expected object or boolean as schema, got array
Expected object or boolean as schema, got array
undefined

Removing the part or renaming it e.g. from "propertyNames" -> "propertyName" at least starts the webserver (even if this schema is not working).

Possible implementation

If displaying some stuff for such validation is hard then at least do not fail or print better message when calling the command. Without the --verbose flag I just got returned undefined and the program exited with code 1.

Your environment

  • Node Version: v10.1.0
  • Operating system and version (e.g. Ubuntu 16.04, Windows 7): Kubuntu 18.10
  • speccy: 0.8.7
@philsturgeon
Copy link
Contributor

philsturgeon commented Jun 13, 2019

Yep this would be expected. The -j switch was designed to convert certain JSON Schema functionality to OpenAPI, and not all of it has been done. propertyNames is JSON Schema, and that is not a keyword in OpenAPI v3. Maybe you could send a PR to https://github.com/wework/json-schema-to-openapi-schema

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

No branches or pull requests

2 participants