redhat-developer / redhat-developer/vscode-yaml

Feature request: Typescript types as Schema

Open
#957 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

This might be a stupid question, but: Could the schema be derived from a Typescript type?

My reasoning for this would be that in most cases (at least for my project) Typescript types can be much more compact than the overly verbose JSON Schema.

For example, in my use cases, the same structure can be represented in 75% less lines, in an easily readable and editable way.

I am currently writing the schema in Typescript and using this cute project to create a file that the vscode-yaml extension accepts.

The absence of this feature is not a deal breaker, and I understand that such a feature might not be implemented due to unreasonable const to value ratio. I'm just here to express that there might be a demand for this feature.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how vscode-yaml currently accepts and loads JSON Schema, then compare that flow with the linked ts-json-schema-generator project. Determine the desired TypeScript type input, conversion behavior, configuration, and validation expectations before proposing an implementation; done would mean a documented, tested path from a TypeScript type to a schema accepted by vscode-yaml.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.