Repository navigation
Conversation
Release previewMerging this PR would release v2.10.0 (current: Changelog preview (truncated)## v2.10.0 (2026-12-04)
### Bug Fixes
- Align the jsonschema regeneration with the form editor
([`cc89362`](https://github.com/OpenSemanticLab/osw-python/commit/cc8936279d4ebdfbca985b046aaa1221cb0fcddc))
- Botfilter for user sync
([`4d6f440`](https://github.com/OpenSemanticLab/osw-python/commit/4d6f4401c63a148c924bef89963b8f18bc8d4b0c))
- Follow properties and items when collecting category templates
([#220](https://github.com/OpenSemanticLab/osw-python/pull/220),
[`55e500e`](https://github.com/OpenSemanticLab/osw-python/commit/55e500efb896f0a3d6bde98409b3a6f43a652bdc))
- Keep the stored jsonschema when store_entity regenerates it
([`9b76a8f`](https://github.com/OpenSemanticLab/osw-python/commit/9b76a8fbeb813b34c4881b54d329e9e837b08f95))
- Select category templates from the schema allOf like the wiki
([#220](https://github.com/OpenSemanticLab/osw-python/pull/220),
[`9f606f4`](https://github.com/OpenSemanticLab/osw-python/commit/9f606f48fefd640cca48e6718f1a92eca118da6b))
- **core**: Flatten $defs/manual before schema code generation
([#229](https://github.com/OpenSemanticLab/osw-python/pull/229),
[`51fa791`](https://github.com/OpenSemanticLab/osw-python/commit/51fa791e427e5e53a65ee6bd0f65530848436b66))
- **core**: Resolve local root pointers of fetched schemas
([#229](https://github.com/OpenSemanticLab/osw-python/pull/229),
[`0dfc8d6`](https://github.com/OpenSemanticLab/osw-python/commit/0dfc8d6725c91b7fc8152ef1806073ed91299f61))
- **core**: Resolve pointers of $defs/generated before merging
([#229](https://github.com/OpenSemanticLab/osw-python/pull/229),
[`4c3a056`](https://github.com/OpenSemanticLab/osw-python/commit/4c3a056c49a308b4aabe533a3d12dadf7668ca92))
- **express**: Connect to http and localhost wikis
([`99584f1`](https://github.com/OpenSemanticLab/osw-python/commit/99584f16d5720d83ba621a3ef4427a5b1f4744bd))
- **user-sync**: Actually remove pruned fields via empty relations and remove_empty
([`87cf85b`](https://github.com/OpenSemanticLab/osw-python/commit/87cf85b31cbfec6b80e2e30b92852c359586133c))
- **user-sync**: Align with stage and the tools docs
([`bc6b0d6`](https://github.com/OpenSemanticLab/osw-python/commit/bc6b0d642f5697ca8048b4be05fd26c9ad2162f6))
- **user-sync**: Count and redirect only stored items
([#224](https://github.com/OpenSemanticLab/osw-python/pull/224),
[`0b8dc97`](https://github.com/OpenSemanticLab/osw-python/commit/0b8dc974e972e8adaa7a2bb03bd3ae4396589f40))
- **user-sync**: Drop python-dotenv, use default accounts.pwd.yaml
([`02570c8`](https://github.com/OpenSemanticLab/osw-python/commit/02570c8f88d6d27c58e1e595bc8bb13e90354fd4))
- **user-sync**: Prune a single-valued key stored with an empty value
([`ebda514`](https://github.com/OpenSemanticLab/osw-python/commit/ebda514c731718ab20a084b93288491b3b944627))
- **user-sync**: Prune by field type and decide from stored jsondata
([`9b36e4e`](https://github.com/OpenSemanticLab/osw-python/commit/9b36e4ef8417b8847ba304535a95c0eedaf628b9))
### Build System
- Require opensemantic>=0.2.5 from PyPI
([`3464469`](https://github.com/OpenSemanticLab/osw-python/commit/3464469d78de95f5b5acdca66d1b8b0e83c53cd6))
### Chores
- **user-sync**: Scaffold module, example and tracking
([`217b101`](https://github.com/OpenSemanticLab/osw-python/commit/217b1017b46295340bc79cee050a91c45c0d379d))
### Continuous Integration
- Run Main on pushes to stage and Integration on PRs into stage
([`1b55f02`](https://github.com/OpenSemanticLab/osw-python/commit/1b55f02c90cae646d690f83d6208c01f0e26e62b))
### Documentation
- State which schema references the template walk follows
([#220](https://github.com/OpenSemanticLab/osw-python/pull/220),
[`799bc07`](https://github.com/OpenSemanticLab/osw-python/commit/799bc07952aac7e6ab579bc127c5cb3000710491))
- **user-sync**: Add user sync guide and finalize example
([`830d120`](https://github.com/OpenSemanticLab/osw-python/commit/830d12072f9acfcbbaa265e5b75e6db38ca0a0d1))
- **user-sync**: Document prune and opt-in extrasPreview via python-semantic-release and conventional commits. |
LukasGold
left a comment
There was a problem hiding this comment.
Manually reviewed the code. Looks fine to me
|
Current convention: anything hand-written sits at the schema root level,
The failure is also not specific to |
- merge targets of local $ref and allOf pointers at the root into the root - root keys win; $defs/generated merge order unchanged - replaces the reverted $defs/manual flattening
|
@simontaurus I reworked the PR along your comment. The title and the description are updated. Changes
Why the CharacteristicType template stays unchangedThe template writes
Stripping of root membersAs we understand the convention, a root definition overwrites the generated definition, also partially, for example only the title, format or range of one property. The readers behave this way: oold's Migration and Module:MwJson
|
Closes #229
Changes
$defs/manualflattening of the first version of this PR (_flatten_manual_definitionsandtests/test_fetch_schema_manual_defs.py).$defs/manualis not an OSW convention: hand-written content sits at the schema root, and$defs/generatedis the only reserved section for template output.src/osw/core.py: new helper_resolve_local_root_pointers.OSW._fetch_schemacalls it for every fetched page with ajsonschemaslot.JsonSchema:pages do not pass through it.$defs/generatedsection, if that section is a dict, with pointers looked up in the page schema. oold'smerge_generated_definitionsdrops the$refof the generated section when the root holds"$ref": "#/$defs/generated", because the root$refwins the merge and is then removed.merge_generated_definitions.#/...) in the root$refand in the rootallOf.merge_deep(target, root), so keys at the root win. This is the merge rule ofresolveSchemainMwJson_util.js. SeveralallOfpointers are merged in list order.allOfentries stay in place. Chains through the root$refor rootallOf, including chains through$defs/generated, are resolved, and a cycle stops the resolution.$defsis kept, so deeper pointers stay valid."$defs": nullor to a missing target, stays unchanged and raises no error.$defs/generateddoes not change: root keys overwrite generated keys, and generated@contextitems come before root items.tests/test_fetch_schema_local_root_pointers.py: 16 offline tests.fetch_schemawith a referenced page that has a local pointer in rootallOf, a chain through$defs/generatedfrom the rootallOfand from the root$ref, a local root$ref, the convention shape, and a remoteallOfentry next to a local one.$defs/generatedkey, also partially inside one property, and generated@contextitems come first.Rationale
datamodel-code-generator copies the root of a referenced page into the referencing node when that node has a key beside its
$refthat is not metadata-only, such astitle*(for exampletitle,description,$comment,examplesanddefaultdo not count). A local pointer of the referenced page is then looked up in the wrong document. For a pointer in the rootallOf, generation fails withA Parser can not resolve classes. For a pointer in the root$ref, generation does not fail, but the field gets the typeAny. The failure does not depend on the namemanual. Merging the pointer targets into the root before the file is written removes the local pointer.Limits
anyOf/oneOfand insidepropertiesare not resolved, and still fail in the same way when such a key sits beside the$ref.$defscan produce an extra, unused model class."$defs": nullstill raisesAttributeErrorin oold'smerge_generated_definitions, which runs before the new helper.Tests
_resolve_local_root_pointersreplaced by a function that returns its input, the 5 newfetch_schematests that involve a local pointer fail: theallOfpointer, both chains, the root$ref(the field is typedAny) and the remoteallOfcase.make checkpasses, andmake testreports 1073 passed.