Code Monkey home page Code Monkey logo

Comments (5)

webpro avatar webpro commented on May 24, 2024

This sounds more like an issue with JSON Schema and/or VS Code. Do you have suggestions on how to improve the schema?

FYI, you can also use a knip.ts and use types like so:

import type { KnipConfig } from 'knip';

const config: KnipConfig = {};

export default config;

from knip.

ElPrudi avatar ElPrudi commented on May 24, 2024

I don't think so. This is the first the first time for me that a schema is broken in vscode.
For my API I used the standard schema from http://json-schema.org/ and VSCode has no problems with it.
Here is a short summary of my schema:

{
    "$schema": "http://json-schema.org/schema",
    "properties": {
        "objProp": {
            "type": "object",
            "description": "An object of the schema",
            "additionalProperties": false,   // can the user define extra properties?
            "required": ["prop1", "prop2", "prop3"], // these props are required for this object property
            "properties": {
                "prop1": {
                    "type": "string",
                    "description": "description of prop1"
                },
                ....
                "prop4": {
                    "type": "string",
                    "description": "I am defined but not required"
                },
            }
        },
        "prop1": true,   // Is part of an object an is required. But it can be used as for other objects too.
        "prop2": true,
        "prop3": true,
        "prop5": {
            "type": "boolean",
            "default": false,  // suggested default value
            "description": "I am a flag"
        },
    "required": ["objProp", "prop5"] // what properties of this schema are required for it to work?
}

I'm new to json schema, but this helped me a lot https://github.com/CyberT33N/JSON-Schema-cheat-sheet

from knip.

ElPrudi avatar ElPrudi commented on May 24, 2024

Another possibility would be that you deploy it from the web, while APIs usually export their schemas. But if I only knew how, I would be happy to help.

from knip.

webpro avatar webpro commented on May 24, 2024

Is this still an issue? I seem to have no issues in my VS Code.

from knip.

ElPrudi avatar ElPrudi commented on May 24, 2024

No, the problems are gone. The auto completion is way better. Well done!

My only nitpick would be that the plugins should not default to false but to {}, since false is already the implicit value.

But for now I close this issue because the original problem is fixed.

from knip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.