Coder Social home page Coder Social logo

Comments (6)

gkssf avatar gkssf commented on June 11, 2024

The generated code makes sense to me since you have provided items as an array: [{ type: "string" }] and not as an object { type: "string" }. It literally assumes that your first element should be of type string.

from json-schema-to-typescript.

eMerzh avatar eMerzh commented on June 11, 2024

as i understand it should be an array of string , not super familiair with json schema, but how is it supposed to be ?

from json-schema-to-typescript.

Shinigami92 avatar Shinigami92 commented on June 11, 2024

as i understand it should be an array of string , not super familiair with json schema, but how is it supposed to be ?

I think they want to tell you that the issue is in eslint, not in json-schema

from json-schema-to-typescript.

eMerzh avatar eMerzh commented on June 11, 2024

hehe, i got the hint @Shinigami92 :) ...

but if i look https://json-schema.org/understanding-json-schema/reference/array

What i understand (again, i'm a noob in jsonschema)

In the following example, we define that each item in an array is a number:

  "type": "array",
  "items": {
    "type": "number"
  }
}
[1, 2, 3, 4, 5]

This let me think that

  "type": "array",
  "items": {
    "type": "string"
  }
}

should allow

["one", "two", "three"]

No ?
if no (which is possible), can you help me find how is it supposed to look ?

from json-schema-to-typescript.

Shinigami92 avatar Shinigami92 commented on June 11, 2024

items: [{type:'string'}] != items: {type:'string'}

from json-schema-to-typescript.

eMerzh avatar eMerzh commented on June 11, 2024

oook :) thanks... let's go open a Pr there :)

from json-schema-to-typescript.

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.