-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Motivation
Goal: generate C# classes from mapbox style JSON schema to have type safe access to the mapbox style from C#. The intent here is to read the mapbox style json file, parse it, and extract style info (colors, line styles) from it for a conversion to CAD.
Problem: There is a JSON schema available for the mapbox style, however it is unclear to what extent it adheres to the official JSON schema spec. This page hints it is a JSON schema: https://docs.mapbox.com/style-spec/guides/, see bottom paragraph "Developer resources" that explicitly mentions and links to JSON schema. However the schema provided at https://github.com/mapbox/mapbox-gl-js/blob/main/src/style-spec/reference/v8.json does not pass validation. Example JSON schema validator here: https://www.jsonschemavalidator.net/. So this blocks the road to standard JSON schema parsers and code generators like Corvus.JsonSchema.
Design Alternatives
So my questions/requests are:
- Is the intent for v8.json to adhere to the JSON schema schema (e.g. Schema draft 2020-12)?
- The validator only reports 2 errors, I suspect it might be possible to make it pass validation with small modifications. Could you provide such a patched schema to facilitate use of standard tooling?
- If the meta schema is quite different from the standard meta schema Schema draft 2020-12, can you provide the meta schema that mapbox used to define the mapbox style JSON schema?
- From the code generation in https://github.com/mapbox/mapbox-gl-js/blob/main/build/generate-typed-style-spec.ts it looks like automatic code generation can be done mostly automatically, but there are some hard coded bits regarding to the class hierarchy? What is your perspective on generating code from the mapbox style JSON schema? Is this a maintainable path for us in the future, or do you recommend taking another path?
Design
Depends on answers to questions above.
Mock-Up
Depends on answers to questions above.
Concepts
Depends on answers to questions above.
Implementation
Depends on answers to questions above.