question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

json_schema_data_formats fail when looking up 'array'

See original GitHub issue

When trying to convert file data.json to model.py, I get a keyerror on line 171 of jsonschema.py when the type in types is ‘array’.

To Reproduce

Example schema:


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JosXacommented, Sep 21, 2020

Alright, will do 👍

1reaction
koxudaxicommented, Jun 25, 2020

@javierabosch Thank you for your email. I have fixed a problem which is a nested array. I released a new version as 0.5.11

But, I found other problems to generate models from your json data.

  1. Need calling update_forward_refs for MediaItem after all dependency models are defined. I will fix the problem when I refactor a function referencing class which is related to the issue https://github.com/koxudaxi/datamodel-code-generator/issues/145 It means a feature is broken which is referencing class.

  2. change types of some field to Optional the code generator uses genson to convert Json data to JSON schema. the problem happens is in genson. You should change types to Optional manually after you generate models.

Read more comments on GitHub >

github_iconTop Results From Across the Web

array — Understanding JSON Schema 2020-12 documentation
In JSON, each element in an array may be of a different type. ... Should be a string from a different set of...
Read more >
Enum inside the Array is not validting in json-schema
In your schema, you have extra brackets [] around the items array type. This means that the enum is checked for the first...
Read more >
Producing Data and Schemas in JSON array-of-array format.
In this article, I'll demonstrate how to produce an array-in-array JSON document, and the schema to go with it. With this, you have...
Read more >
Restructuring of output formatting · Issue #973 · json-schema ...
While writing Section 10 on output, I was implementing the formatting in my library, Manatee.Json. In that library, I don't collect ...
Read more >
Array type | Opis JSON Schema
An array is valid against this keyword if at least one item is valid against the schema defined by the keyword value. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found