Repository navigation
feat(schemas): shared schema types - #35
Merged
Merged
Conversation
generate_data_types.py writes the values of each Literal type of data_types.py (data_types.json) and their TypeScript unions (data_types.d.ts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each package defines the schema types it is the lowest to use in its schema_types.json, generated as dataclasses and TypeScript interfaces. A type can extend another one (ColorRGBA extends ColorRGB). Only DataId, GeodeId, ViewerId, AttributeName, Filename and Point3D are used by both OpenGeodeWeb-Back and OpenGeodeWeb-Viewer, so they are defined here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A field titled after a shared type (e.g. {"title": "ColorRGBA"}) is expanded in the
generated files, and the generated code imports the shared type instead of
declaring its own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
load_schema and get_schemas_dict expand them from the schema_definitions.json generated in the package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JulienChampagnol
marked this pull request as ready for review
November 19, 2026 14:18
This was referenced Nov 19, 2026
DataId, GeodeId, ViewerId, AttributeName and Filename are now importable types (e.g. DataId = str, export type DataId = string). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ColorRGB and ColorRGBA are defined by OpenGeodeWeb-Viewer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A field titled after an alias (e.g. {"title": "DataId"}) is typed with it
(id: DataId) instead of its own type (id: str). A route module declaring a class
named like an alias (the Visibility params) imports it as VisibilityType.
The generated modules importing shared types keep them as runtime imports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the generated TypeScript, a field described on one line is followed by its description (points: ColorMapPoints; // Flat array of [value, r, g, b, ...]) instead of a block comment above it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ViewerId, AttributeName, Filename and Point3D are defined by OpenGeodeWeb-Back and OpenGeodeWeb-Viewer. Packages not depending on each other may define the same type: a package seeing both requires the same definition. A package may only define aliases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BlockIds = list[ViewerId] instead of list[int], each alias declared after the ones it uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… package The CI installs the dependencies of a package in its node_modules, but removes their "0.0.0" versions from its package.json: the generator did not see them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
A response that is a shared type (the {x, y, z} of get_point_position is a
Point3D) was replaced by it, but the Schemas tree still named it: it is now an
alias of the shared type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BotellaA
approved these changes
Nov 20, 2026
| from sqlalchemy import String, select | ||
| from sqlalchemy.orm import Mapped, mapped_column | ||
|
|
||
| from opengeodeweb_microservice.schema_types import DataId, GeodeId # noqa: TC001 |
This was referenced Nov 20, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One source of truth for the types used by the route schemas of the microservices.
generate_data_types.pyalso writesdata_types.json(the values of eachLiteraltype) anddata_types.d.ts.src/<package>/schema_types.json, generated as dataclasses (schema_types.py) and interfaces (schema_types.d.ts).schema_types.jsonof the package and of its@geode/*dependencies; a type defined twice is an error.extendsanother one (ColorRGBAextendsColorRGB).DataId = str,export type DataId = string), and the generated code names them:id: DataIdinstead ofid: str.DataIdandGeodeId(its database uses them). Back defines CRS, the model components, and with ViewerViewerId,AttributeName,FilenameandPoint3D; Viewer defines the colors and styles. Packages not depending on each other may define the same type, with the same definition.{"title": "ColorRGBA"}.*_schemas.json, Python and TypeScript types), which import the shared type instead of declaring their own.src/<package>/schema_definitions.jsonfor the runtime.load_schemaandget_schemas_dictexpand the shared types from that file, sofastjsonschemastill validates the full schemas.Data.idis aDataIdandData.geode_idaGeodeId.generate_schema_types.jsandschema_types.py, needed by the generator in the other repos.Test plan
tests/test_schemas.py)🤖 Generated with Claude Code