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

Certain JSON schema-like objects are not recognized #211

Closed
P0lip opened this issue Oct 23, 2019 · 4 comments
Assignees
Labels

Comments

@P0lip
Copy link
Member

@P0lip P0lip commented Oct 23, 2019

Describe the bug
Studio does its best to recognize JSON Schema models with missing $schema.
Unfortunately, it does recognize 'complex' types properly.

To Reproduce

  1. Given the following JSON Schema-like object
type: [object, string]
properties:
  id:
    type: string
  1. Studio treats it as a regular file.

Additional context
Spotted this when working on models importing.
I revisited the G. code, because I wanted to re-export the schema detection util and noticed the issue.

@P0lip P0lip added the bug label Oct 23, 2019
@P0lip P0lip self-assigned this Oct 23, 2019
@P0lip P0lip closed this Oct 23, 2019
@marbemac marbemac reopened this Oct 23, 2019
@marbemac

This comment has been minimized.

Copy link
Member

@marbemac marbemac commented Oct 23, 2019

@P0lip move over to qa pipeline once it's in studio please.

@StoplightDeb

This comment has been minimized.

Copy link

@StoplightDeb StoplightDeb commented Oct 28, 2019

@P0lip - is this testable by just pasting your example into the write view when making a model? What should we be looking for. and is there anything specific that needs to be done for testing this?
Cc: @chris-miaskowski

@P0lip

This comment has been minimized.

Copy link
Member Author

@P0lip P0lip commented Oct 28, 2019

@P0lip - is this testable by just pasting your example into the write view when making a model? What should we be looking for. and is there anything specific that needs to be done for testing this?

You can have a existing model somewhere in the project you clone, for instance.
The model must have a "complex" type, i.e.

type: [number, string]

To reproduce, just create such a file (either in file explorer in your OS, or in the repo, or via Studio) and paste the following content and obviously save or commit & push.

type: [object, string]
properties:
  id:
    type: string

Then, in Studio, open the file in Studio and see that it's not recognized as json schema model and hence missing in APIs tree and have no icon / form associated.
LMK if that helps!

@stoplightAutomaton

This comment has been minimized.

Copy link

@stoplightAutomaton stoplightAutomaton commented Oct 29, 2019

Thanks for the elaboration, this looks good on staging!
^ from deb, was still logged in with testing account, which is part of stoplightio org :facepalm: signing out now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.