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 intellisense for new file types #47

Open
carolynvs opened this issue Sep 17, 2021 · 2 comments
Open

Support intellisense for new file types #47

carolynvs opened this issue Sep 17, 2021 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@carolynvs
Copy link
Member

carolynvs commented Sep 17, 2021

In Porter v1, we introduced some new files that people will be editing by hand and it would be great if VS Code would autocomplete these documents when the Porter extension is installed.

  • credential set
  • parameter set
  • installation
  • plugins (the file argument passed to porter plugins install -f plugins.yaml)

Here is an example of what they look like and they are documented at https://getporter.org/reference/file-formats/ with links to the corresponding json schema files.

Credential Set

schemaType: CredentialSet
schemaVersion: 1.0.0
namespace: demo
name: whalegap
credentials:
  - name: kubeconfig
    source:
      path: /Users/carolynvs/.kube/config

Parameter Set

schemaType: ParameterSet
schemaVersion: 1.0.0
namespace: demo
name: hello-llama
parameters:
  - name: name
    source:
      env: USER

Installation

schemaType: Installation
schemaVersion: 1.0.0
name: demo
namespace: demo
bundleRepository: carolynvs/tabbycat-demo
bundleVersion: 0.2.1

Plugins

schemaType: Plugins
schemaVersion: 1.0.0
plugins:
  helm3:
    version: v1.0.1
    url: https://github.com/MChorfa/porter-helm3/releases/download

Seems like before porter releases we should tweak the schemaVersion field to indicate which file it is, e.g. schemaVersion: "credential-set-1.0.0", so that VS code can detect the type of file? Or do you recommend another way, like a separate field like kind: credential-set`? Porter now adds a schemaType field so that we can detect the file type. So if a file is yaml, and it contains a known schemaType, then we should apply the corresponding json schema so that the user gets autocomplete.

Since the schema for these is fixed (unlike porter.yaml which is generated directly by porter on demand), I was thinking that the extension could download the schema from a well-known url, e.g. https://getporter.org/schema/VERSION/FILE_TYPE.json. So the installation schema from https://raw.githubusercontent.com/getporter/porter/release/v1/pkg/schema/installation.schema.json (this isn't the URL we want to use in the extension) would be available at https://getporter.org/schema/v1/installation.schema.json (this is the URL to use in the extension, so that we can improve or fix it later as needed using URL redirects).

@carolynvs
Copy link
Member Author

Long term it would be cool to get autocomplete support for the parameters/credentials names by querying porter but for now just having any syntax support would be nice.

@carolynvs
Copy link
Member Author

carolynvs commented Apr 4, 2022

Update: Porter v1 now embeds a schemaType and schemaVersion field in each file so that the extension could use these values to determine the proper jsonschema to apply to the file.

So if you opened a file that had those two fields, the porter extension could download the schema from

Installation -> https://getporter.org/schema/v1/installation.schema.json
CredentialSet -> https://getporter.org/schema/v1/credential-set.schema.json
ParameterSet -> https://getporter.org/schema/v1/parameter-set.schema.json
Plugins -> https://getporter.org/schema/v1/plugins.schema.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant