Comments (12)
That looks like it has fixed the issue with the _id
and _type
fields :)
from iiif-prezi3.
The other bug with LngString
seems to persist, sadly
from iiif-prezi3.
@digitaldogsbody
Thank you for explaining the detail
I tried the command with the master branch version.
The problem is solved with the latest code.
I will release a new version within a few days.
$ pip install git+https://github.com/koxudaxi/datamodel-code-generator.git
# generated by datamodel-codegen:
# filename: iiif_3_0.json
# timestamp: 2023-01-28T09:41:10+00:00
from __future__ import annotations
from datetime import datetime
from typing import Any, Dict, List, Optional, Union
from pydantic import AnyUrl, Extra, Field, PositiveFloat, PositiveInt, constr
...
class LngString(Base):
__root__: Union[
Dict[constr(regex=r'^[a-zA-Z-][a-zA-Z-]*$'), List[str]],
Dict[constr(regex=r'^none$'), List[str]],
] = Field(
..., title='Language string, must have a language and value must be an array.'
)
...
from iiif-prezi3.
Amazing, thank you so much!
from iiif-prezi3.
Looks like koxudaxi/datamodel-code-generator#917 doesn't fix our issues as it adds a prefix before the underscore e.g. field_id
we want to remove the _
from the beginning.
from iiif-prezi3.
@glenrobson
OK. I will think about how to resolve the problem.
from iiif-prezi3.
@glenrobson
I have released the new version as 0.16.1
Could you please --remove-special-field-name-prefix
as CLI option?
Thank you very much!!
from iiif-prezi3.
Thanks @koxudaxi we will run a test!
from iiif-prezi3.
@digitaldogsbody Thank you for testing it.
The other bug with LngString seems to persist, sadly
Could you please explain the problem?
from iiif-prezi3.
@koxudaxi Thanks so much for the responsive fixes - it makes a big difference to our project
The other issue is the one that @giacomomarchioro opened here: koxudaxi/datamodel-code-generator#696
In the types
section of our schema, we have:
"lngString": {
"title": "Language string, must have a language and value must be an array.",
"type": "object",
"patternProperties": {
"^[a-zA-Z-][a-zA-Z-]*$": {
"type": "array",
"items": { "type": "string"}
},
"^none$": {
"type": "array",
"items": { "type": "string"}
}
},
"additionalProperties": false
},
datamodel-code-generator
(0.16.1) is creating:
class LngString(Base):
pass
class Config:
extra = Extra.forbid
We are expecting something like:
class LngString(Base):
__root__: Dict[str, List[str]]
class Config:
extra = Extra.forbid
from iiif-prezi3.
The whole schema file is here: https://github.com/IIIF/presentation-validator/blob/2f9f7e4ec5f671ebcdf8b2eef76cae2a7d50f26b/schema/iiif_3_0.json
And the command we are using is: datamodel-codegen --input iiif_3_0.json --input-file-type jsonschema --use-default --remove-special-field-name-prefix --strict-nullable --base-class .base.Base --output skeleton.py
from iiif-prezi3.
datamodel-code-generator 0.17.0 is out (https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.17.0) which contains the above fix - so we should update to that and test that it's resolved the LngString issue
from iiif-prezi3.
Related Issues (20)
- `navDate` property causes serialization error
- `ManifestRef` does not allow additional properties
- Refactor `canvas_helpers.py` to split out `add_thumbnail` functionality
- Allow AutoLabel to work in other places that have a .label property
- Add AutoId functionality everywhere it can apply
- Update recipe 1
- Fix failing CI
- Rediscuss about validate on assignment HOT 4
- Avoid escaping non-ASCII characters
- Make the Cookbook Checker script spit out more useful information
- Cookbook checker script only works from `utils` directory
- Update existing helpers for new Canvas types
- Can't create SVG Selectors for Annotations HOT 5
- Can't add AnnotationPage to a Canvas `items` by reference
- make_manifest() helper on Collection drops homepage property when provided
- Supporting choice on a canvas
- Add label should be present on annotation body
- Suspected bug with adding annotations to existing AnnotationPage
- Range does not have a property "behavior"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iiif-prezi3.