Elements icon indicating copy to clipboard operation
Elements copied to clipboard

Missing Json types

Open Gytaco opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. I would like to have MeshElement.json created and Topography.json so I can reference these elements in other schemas.

Describe the solution you'd like Currently, these object types are not available from json which means I am unaware of any method to include it as a serialisable object for other Element types I would like to create and integrate.

Describe alternatives you've considered I have looked around and through the forums but there appears to be no way to reference a class object directly.

Additional context My only other comment is to understand what criteria is required for objects that go into https://github.com/hypar-io/Elements/tree/master/Schemas vs https://github.com/hypar-io/Schemas. There appears to be overlap and there are a number of features in Schemas with the code in the Elements repository. Cleaning this up would make it clearer for users.

Gytaco avatar Jul 01 '21 21:07 Gytaco

~~You should be able to depend on MeshElements + Topography in other functions — because they are "built-in," you don't need to include them in element_types. To get the topography from the Location function, simply add a dependency on location and get AllElementsOfType<Topography>. See the Cut And Fill function for an example: https://github.com/hypar-io/CutAndFill~~

Ah, was too hasty - misread your initial issue.

andrewheumann avatar Jul 01 '21 21:07 andrewheumann

There is a schema for MeshElement here: https://prod-api.hypar.io/schemas/MeshElement. We don't currently expose a public schema for Topography, but we could fix this.

andrewheumann avatar Jul 01 '21 21:07 andrewheumann

To give some more context around our future plans w/r/t schemas — Neither of those locations (https://github.com/hypar-io/Elements/tree/master/Schemas and https://github.com/hypar-io/Schemas) are our "final" strategy for schemas. Instead, we are developing a schema manager UI, where it is easy to browse all available schemas and create new ones: image

andrewheumann avatar Jul 01 '21 21:07 andrewheumann

Thanks Andrew it would be great if there was a way to see those lists? Or is that currently internal?

Here is the snippet of the type I am creating called site. The "SiteSurface" property is what I would like to link with the topography object.

{ "$id": "/Site.json", "$schema": "http://json-schema.org/draft-07/schema#", "description": "The features required for the Site Component.", "title": "Site", "x-namespace": "Elements", "type": [ "object", "null" ], "allOf": [ { "$ref": "https://hypar.io/Schemas/Element.json" } ], "required": [ "discriminator"], "discriminator": "discriminator", "properties": { "discriminator": { "type": "string" }, "SiteBoundaries": { "description": "The site parcels.", "$ref": "Layout.json" }, "SiteSurface": { "description": "The site topography.", "$ref": "TOPOGRAPHY.json" }, }, "additionalProperties": false }

Gytaco avatar Jul 01 '21 21:07 Gytaco

For 2.0, we should expose a schema for topography.

ikeough avatar Apr 17 '23 17:04 ikeough