Generate class hierarchy from JSON Schema
Hi there, anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ? Thank you. -- Serge Stinckwic h Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) U niversity of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich
We have https://github.com/zweidenker/JSONSchema <https://github.com/zweidenker/JSONSchema> which is an implementation of basic stuff in JSON schema. But it does not compile classes it just creates a runtime model. To be honest I never understood why we make the effort to compile classes for parsed model. The runtime model works usually pretty well. The only reason I can see is that it is easier to store somewhere. If you like our code and you miss things, we are eager to add the stuff we not had (yet) reason to do so. Norbert
Am 18.01.2020 um 09:20 schrieb Serge Stinckwich <serge.stinckwich@gmail.com>:
Hi there,
anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ?
Thank you.
-- Serge Stinckwich Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) University of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich>
Great work ! I will have a look. I want to be able to generate JSON files following a JSON Schema with a high level API. So my idea was to generate automatically from JSON Schema the class hierarchy but a runtime model might be enough maybe. Regards, Sent from my iPhone
On 18 Jan 2020, at 09:28, Norbert Hartl <norbert@hartl.name> wrote:
We have
https://github.com/zweidenker/JSONSchema
which is an implementation of basic stuff in JSON schema. But it does not compile classes it just creates a runtime model. To be honest I never understood why we make the effort to compile classes for parsed model. The runtime model works usually pretty well. The only reason I can see is that it is easier to store somewhere.
If you like our code and you miss things, we are eager to add the stuff we not had (yet) reason to do so.
Norbert
Am 18.01.2020 um 09:20 schrieb Serge Stinckwich <serge.stinckwich@gmail.com>:
Hi there,
anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ?
Thank you.
-- Serge Stinckwich Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) University of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich
Serge I would also be interested in seeing what you come up with. On Sat, Jan 18, 2020 at 3:56 AM <serge.stinckwich@gmail.com> wrote:
Great work ! I will have a look.
I want to be able to generate JSON files following a JSON Schema with a high level API. So my idea was to generate automatically from JSON Schema the class hierarchy but a runtime model might be enough maybe.
Regards,
Sent from my iPhone
On 18 Jan 2020, at 09:28, Norbert Hartl <norbert@hartl.name> wrote:
We have
https://github.com/zweidenker/JSONSchema
which is an implementation of basic stuff in JSON schema. But it does not compile classes it just creates a runtime model. To be honest I never understood why we make the effort to compile classes for parsed model. The runtime model works usually pretty well. The only reason I can see is that it is easier to store somewhere.
If you like our code and you miss things, we are eager to add the stuff we not had (yet) reason to do so.
Norbert
Am 18.01.2020 um 09:20 schrieb Serge Stinckwich < serge.stinckwich@gmail.com>:
Hi there,
anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ?
Thank you.
-- Serge Stinckwic h
Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) U niversity of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich
-- Eric
I had a look Norbert, but some features are missing like support for anyOf or multiple types like: { "type": ["string", "null"] } I need some time to understand how to add them. On Sat, Jan 18, 2020 at 9:55 AM <serge.stinckwich@gmail.com> wrote:
Great work ! I will have a look.
I want to be able to generate JSON files following a JSON Schema with a high level API. So my idea was to generate automatically from JSON Schema the class hierarchy but a runtime model might be enough maybe.
Regards,
Sent from my iPhone
On 18 Jan 2020, at 09:28, Norbert Hartl <norbert@hartl.name> wrote:
We have
https://github.com/zweidenker/JSONSchema
which is an implementation of basic stuff in JSON schema. But it does not compile classes it just creates a runtime model. To be honest I never understood why we make the effort to compile classes for parsed model. The runtime model works usually pretty well. The only reason I can see is that it is easier to store somewhere.
If you like our code and you miss things, we are eager to add the stuff we not had (yet) reason to do so.
Norbert
Am 18.01.2020 um 09:20 schrieb Serge Stinckwich < serge.stinckwich@gmail.com>:
Hi there,
anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ?
Thank you.
-- Serge Stinckwic h
Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) U niversity of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich
-- Serge Stinckwic âhâ Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) âSorbonne University (SU) French National Research Institute for Sustainable Development (IRD)â U âniversity of Yaoundé Iâ, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich â
Serge, as I mentioned at first you need to complain. I meant it that if you miss stuff I'm eager to add that. Of course it would be lovely if you do it yourself. Just saying that if there is need I can look into. Don't forget open issues on the git repo and add examples what you want to parse or submit a PR with a red test that would be best. Norbert
Am 20.01.2020 um 19:34 schrieb Serge Stinckwich <serge.stinckwich@gmail.com>:
I had a look Norbert, but some features are missing like support for anyOf or multiple types like: { "type": ["string", "null"] }
I need some time to understand how to add them.
On Sat, Jan 18, 2020 at 9:55 AM <serge.stinckwich@gmail.com <mailto:serge.stinckwich@gmail.com>> wrote: Great work ! I will have a look.
I want to be able to generate JSON files following a JSON Schema with a high level API. So my idea was to generate automatically from JSON Schema the class hierarchy but a runtime model might be enough maybe.
Regards,
Sent from my iPhone
On 18 Jan 2020, at 09:28, Norbert Hartl <norbert@hartl.name <mailto:norbert@hartl.name>> wrote:
We have
https://github.com/zweidenker/JSONSchema <https://github.com/zweidenker/JSONSchema>
which is an implementation of basic stuff in JSON schema. But it does not compile classes it just creates a runtime model. To be honest I never understood why we make the effort to compile classes for parsed model. The runtime model works usually pretty well. The only reason I can see is that it is easier to store somewhere.
If you like our code and you miss things, we are eager to add the stuff we not had (yet) reason to do so.
Norbert
Am 18.01.2020 um 09:20 schrieb Serge Stinckwich <serge.stinckwich@gmail.com <mailto:serge.stinckwich@gmail.com>>:
Hi there,
anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ?
Thank you.
-- Serge Stinckwich Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) University of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich>
-- Serge Stinckwicâhâ Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) âSorbonne University (SU) French National Research Institute for Sustainable Development (IRD)â Uâniversity of Yaoundé Iâ, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich> â
I have some work around building class hierarchies from database schema - specifically a Rails style Active Record schema. It is a bit of a work in progress and is intended to be folded into Glorp but you can see where I am at https://github.com/pharo-db/glorp/blob/13-Drive-DescriptorSystem-creation-en... <https://github.com/pharo-db/glorp/blob/13-Drive-DescriptorSystem-creation-en...> Maybe it helps?
On Jan 18, 2020, at 12:20 AM, Serge Stinckwich <serge.stinckwich@gmail.com> wrote:
Hi there,
anyone has experience about generating a class hierarchy from a JSON Schema ? Code available somewhere ?
Thank you.
-- Serge Stinckwich Int. Research Unit on Modelling/Simulation of Complex Systems (UMMISCO) Sorbonne University (SU) French National Research Institute for Sustainable Development (IRD) University of Yaoundé I, Cameroon "Programs must be written for people to read, and only incidentally for machines to execute." https://twitter.com/SergeStinckwich <https://twitter.com/SergeStinckwich>
participants (5)
-
Eric Gade -
Norbert Hartl -
Serge Stinckwich -
serge.stinckwich@gmail.com -
Todd Blanchard