New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update datamodel-code-generator to version 0.17.0 #156
Comments
Looks like koxudaxi/datamodel-code-generator#917 doesn't fix our issues as it adds a prefix before the underscore e.g. |
@glenrobson |
@glenrobson |
Thanks @koxudaxi we will run a test! |
That looks like it has fixed the issue with the |
The other bug with |
@digitaldogsbody Thank you for testing it.
Could you please explain the problem? |
@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 "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
},
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 |
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: |
@digitaldogsbody $ 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.'
)
... |
Amazing, thank you so much! |
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 |
A couple of the issues we reported have now been fixed so we should see if we can remove the workarounds with generating the schema.
This one is to do with the lang string issues: (and we could close #23) (datamodel v 0.15.0)
koxudaxi/datamodel-code-generator#696
This one is to do with the
@id
and@type
issues we've seen in services (datamodel v 0.14.1):koxudaxi/datamodel-code-generator#917
we originally discussed this issue here.
The text was updated successfully, but these errors were encountered: