Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃敭 Generated Objects classes using JSON schemas from speckle-sharp #1

Closed
wants to merge 2 commits into from

Conversation

izzylys
Copy link
Contributor

@izzylys izzylys commented Nov 24, 2020

This is super duper wip, but I'm making a PR as a discussion point.

Schemas for objects should be generated rather than hand crafted as the development effort required to keep them in step with speckle-sharp and any future kits we'd want to support would be a bit ridiculous. One option would be to generate JSON schemas from speckle-sharp/objects and then use these here in speckle-py (and wherever else we need them).

As an initial experiment, JSON schemas were generated from sharp/objects using Newtonsoft and the classes were generated here with pydantic's datamodel codegen. Minimal customisations were used to get the results shown here.

The classes here are stupid simple and references were all generated in the same file which obv we would want to change, but I didn't get into the weeds with how to do this. I wanted to put them up though to show something tangible and start a discussion.

Pinging @tsvilans as we were chatting about this previously!

just geometry classes for now

TODO: consolidation after generating the classes.
this is the raw generation which creates duplicates as it defines all
required classes in the same file
there is loads of repetition since a whole class and it's references
are defined in the same file. need to figure out a way to get them to
generate with references. just uploading this for now so it is visible
for ppl to check out
@izzylys izzylys changed the title 馃敭 Generated Objects classes using JSON schemas from Core 馃敭 Generated Objects classes using JSON schemas from speckle-sharp Nov 24, 2020
@izzylys izzylys added documentation Improvements or additions to documentation question Further information is requested and removed documentation Improvements or additions to documentation question Further information is requested labels Dec 8, 2020
iainsproat pushed a commit that referenced this pull request Aug 9, 2022
Moved relevant files to .github/ folder
@majidaldo
Copy link

is this for #237? the issue is much newer though.

@AlanRynne
Copy link
Member

Well... @majidaldo it is definitely related, but this draft is so old that we may have to start from scratch the whole idea.

I remember there were some not so nice conclusions Izzy reached when doing this, that made it not a very good candidate overall.

#237 is more on the lines of creating some tests that will let us know when objects from one language cannot be deserialised in another, which would still be needed even if we generated all code from a "single source of truth".

But good catch! I hadn't linked to this PR on my issue, thx!

@gjedlicska
Copy link
Collaborator

Yup, I'm closing this and we'll rethink when we get there.

@gjedlicska gjedlicska closed this Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants