mnboos / jsonschema-default

A Python package that creates default objects from a JSON schema
GNU Affero General Public License v3.0
9 stars 5 forks source link

Failure under python 3.11 #11

Open gsemet opened 1 year ago

gsemet commented 1 year ago

Hello. jsonschema-default uses xeger has calls a undocumented function sre_parse that has been deprecated in 3.11. Can you switch to another lib?

mnboos commented 1 year ago

Hi and thanks for the hint

I will check if I can use rstr instead

gsemet commented 1 year ago

isn't is possible to disable this feature? I do not feel safe with random string generation when loading my json file !

mnboos commented 1 year ago

Out of curiosity, what exactly makes you feel unsafe regarding random strings?

The pattern is an official jsonschema property, which I will try to support and thus not remove it.

gsemet commented 1 year ago

You mean that the dictionary you create shall directly respect the schema ? it makes sense, but i would like to be able to avoid this because this can lead to unwanted data being injected in the json. What I am looking for is basically i have a json file with the content that matches the schema, but i would like to have default value initialized when it is loaded. i use "remerge" to merge the output of jsonschema_default with this json)

mnboos commented 1 year ago

You mean that the dictionary you create shall directly respect the schema ?

Yes, that's what this project aims to achieve.

but i would like to have default value initialized

What default value do you mean exactly?

gsemet commented 1 year ago

i want to load a file that respects the schema except for nodes that have a default values.

mnboos commented 1 year ago

Can you provide a complete minimal example of your usecase?