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

Support versions from schemastore #639

Closed
gorkem opened this issue Jan 7, 2022 · 11 comments · Fixed by #675 or redhat-developer/vscode-yaml#710
Closed

Support versions from schemastore #639

gorkem opened this issue Jan 7, 2022 · 11 comments · Fixed by #675 or redhat-developer/vscode-yaml#710
Assignees
Milestone

Comments

@gorkem
Copy link
Collaborator

gorkem commented Jan 7, 2022

Schemastore has a versions field that lists the older versions of a schema. As you can see from the example below the url field points to the latest/default schema while versions lists all versions available. We should introduce a code lens to switch between the versions of a schema.

Moreover, we can use values of fields such as apiVersion or schemaVersion to match the schema version.

     "name": "Airlock Microgateway",
     "description": "Airlock Microgateway configuration schema",
      "url": "https://json.schemastore.org/airlock-microgateway-3.1.json",
      "fileMatch": [
        "microgateway-config.yaml",
        "microgateway-config.yml",
        "airlock-microgateway-config.yaml",
        "airlock-microgateway-config.yml"
      ],
      "versions": {
        "3.0": "https://json.schemastore.org/airlock-microgateway-3.0.json",
        "3.1": "https://json.schemastore.org/airlock-microgateway-3.1.json"
      }
@maysunfaisal
Copy link

What happens if a schema does not have properties like apiVersion or schemaVersion and still has support for multiple versions in the schema store?

@evidolob
Copy link
Collaborator

I was thinking on providing some some of UI, to allow select schema with specific version

@gorkem
Copy link
Collaborator Author

gorkem commented Feb 18, 2022

A schema with 2 versions as separate entries in the schema store is a bug on schema that should be fixed on the schema store. The versions API suggests that the schema store intends to solve multiple versions with this API.

@gorkem
Copy link
Collaborator Author

gorkem commented Feb 18, 2022

What do you have in mind for UI?

@evidolob
Copy link
Collaborator

We don't have a much options, I was thinking on extending status bar item which currently show current schema, I may extend it functionality, and add schema version selection(in case if used schema from json schema store and has more then one version)
Other option is adding more codelens items on schema, like Schema.json(2.1) | Use 1.0 | Use 2.0, click on Use {version} will change current schema.

@gorkem
Copy link
Collaborator Author

gorkem commented Feb 21, 2022

I favor the status bar option too. Code lens is too invasive for this kind of usage

@evidolob
Copy link
Collaborator

@gorkem There demo for what I have now:

Screen.Recording.2022-02-23.at.16.24.13.mov

Is it obvious way to change used json schema version?

@evidolob
Copy link
Collaborator

evidolob commented Mar 1, 2022

@gorkem Could you look on my demo?

@evidolob evidolob modified the milestones: 1.5.0, 1.6.0 Mar 1, 2022
@gorkem
Copy link
Collaborator Author

gorkem commented Mar 1, 2022

Yes, the UI looks OK. How are we going to remember the selected version? Is it going to be a selection per file/workspace?

@evidolob
Copy link
Collaborator

evidolob commented Mar 2, 2022

I plan to store it in user preferences, workspace first

@gorkem
Copy link
Collaborator Author

gorkem commented Mar 2, 2022

Yes, preferences make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment