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

Added a JSON schema for telefonistka.yaml files #73

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

tk-nguyen
Copy link
Contributor

Description

Added a JSON schema for completion in editors.
Part of https://commercetools.atlassian.net/browse/ENE-104

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Notes

Completions should work in editors, provided you specify this schema. Here are some docs on how to do that:

If you're using vim or emacs you can RTFM :-)

@Oded-B
Copy link
Collaborator

Oded-B commented Feb 20, 2025

We can ignore the CI failure - there's some unrelated bug that fails the docker build from forks

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://json.schemastore.org/telefonistka.json",
"title": "Schema for telefonistka.yaml files",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"title": "Schema for telefonistka.yaml files",
"title": "Schema for repo-level telefonistka.yaml files",

We have two kinds of telefonistka.yaml files, repo-level that is placed in the repo root directory and a component-level one, and that one has a different scheme.

We don't need to include the component-level scheme in this PR but we should name it in a way that support a later addition

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, maybe also change the id field

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add the component-level elements in the schema, but the completion might be confusing because it will show all available elements.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'll add a seperate scheme in a separate file
and the # yaml-language-server: $schema= URL will point to different file for each type.
But I've never used a json scheme so I'm not sure exactly how it works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using the YAML plugin for VS Code it will automatically pull the matching schema for the file from http://www.schemastore.org/json/. We might want to make a PR to https://github.com/SchemaStore/schemastore later.

For now, we can use # yaml-language-server: $schema URL pointing to the raw schema JSON.

@tk-nguyen
Copy link
Contributor Author

After merging this I will make a PR on https://github.com/SchemaStore/schemastore.

@Oded-B Oded-B merged commit 81e1e9b into commercetools:main Feb 20, 2025
4 of 5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants