Skip to content

fix(core): detect CharacteristicType from the opensemantic packages too - #213

Merged
simontaurus merged 1 commit into
mainfrom
fix/characteristic-type-from-opensemantic
Oct 10, 2026
Merged

simontaurus merged 1 commit into
mainfrom
fix/characteristic-type-from-opensemantic

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

store_entity writes the generated schema flat instead of into $defs.generated when the entity comes from the released opensemantic packages.

The check only knows the locally generated class:

if hasattr(model, "CharacteristicType") and isinstance(entity_, model.CharacteristicType):
    mode = AggregateGeneratedSchemasParamMode.DEFINITIONS_SECTION

Characteristics built from opensemantic.core.v1 derive from that package's CharacteristicType, not from the one in osw.model.entity, so the isinstance check fails and the mode stays ROOT_LEVEL. The autogenerated half then lands at the root of the schema and overwrites the manually maintained part on the next save.

Changes

  • import CharacteristicType from opensemantic.core.v1 as an optional dependency, None when the package is absent
  • accept either class in the isinstance check
  • guard the change_id tagging in store_entity against entity models without a meta field, which the same models hit

Found while building world.opensemantic.characteristics.quantitative v0.7.0, where 952 schema files came out flat. With the patch the diff drops to the 25 files that actually changed.

- entities built from opensemantic.core.v1 derive from its
  CharacteristicType, not the one in osw.model.entity, so the generated
  schema was written flat instead of into $defs.generated
- tolerate entity models without a meta field when tagging change ids
@github-actions

Copy link
Copy Markdown
Contributor

Release preview

Merging this PR would release v2.8.2 (current: v2.8.1).

Changelog preview (truncated)
## v2.8.2 (2026-10-10)

### Bug Fixes

- Detect CharacteristicType from the opensemantic packages too
  ([`f195a97`](https://github.com/OpenSemanticLab/osw-python/commit/f195a973b141cf830c65656ab946ca454e7309aa))

Preview via python-semantic-release and conventional commits.

@simontaurus
simontaurus merged commit 1b92f9c into main Oct 10, 2026
34 of 35 checks passed
@simontaurus
simontaurus deleted the fix/characteristic-type-from-opensemantic branch October 10, 2026 03:26
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.

1 participant