You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depends on #1, #10. Not blocking for 0.2.0 — follow-up depth issue.
Summary
Resolve allOf/oneOf/anyOf composition and discriminator-based polymorphism in JSON Schemas encountered while parsing an OpenAPI spec, so that schema-driven features (#10's synthesis, any future validation-adjacent feature) work correctly against real-world specs that use these constructs — which is common, especially for polymorphic response shapes.
Current state
The core parser built in #1 is explicitly scoped to a subset of OpenAPI (see #1's "explicitly out of scope" list): allOf/oneOf/anyOf/discriminator resolution is called out there as deferred. This issue is where that deferred work actually gets scoped and built once there's a concrete need for it (most likely driven by #10's schema synthesis hitting a composed schema and not knowing what to do with it).
What to build
allOf: merge all member schemas' properties into one effective schema.
oneOf/anyOf without a discriminator: pick a strategy for which variant to use when synthesizing (Dependency Dashboard #10) — likely "first declared variant" is a reasonable default, since there's no runtime data to disambiguate at spec-parse time.
oneOfwith a discriminator: resolve discriminator.propertyName and discriminator.mapping to determine which variant a given example or synthesized value actually represents.
This is meaningfully more complex than the rest of the parser (#1) — JSON Schema composition has real edge cases (conflicting property definitions across allOf members, circular refs, etc.). Scope the first pass narrowly (handle the common, well-formed cases; fail loudly rather than silently misinterpreting on anything unusual) rather than attempting full JSON Schema spec conformance.
Acceptance criteria
allOf member schemas are merged correctly for the common case (non-conflicting properties).
oneOf/anyOf without a discriminator falls back to a documented, deterministic strategy.
oneOf with a discriminator resolves to the correct variant given a discriminator.propertyName value.
Malformed or unusually-structured composition (e.g. conflicting allOf members) fails with a clear error rather than silently producing a wrong result.
Tests cover all of the above against realistic fixture schemas.
Part of #72
Depends on #1, #10. Not blocking for 0.2.0 — follow-up depth issue.
Summary
Resolve
allOf/oneOf/anyOfcomposition anddiscriminator-based polymorphism in JSON Schemas encountered while parsing an OpenAPI spec, so that schema-driven features (#10's synthesis, any future validation-adjacent feature) work correctly against real-world specs that use these constructs — which is common, especially for polymorphic response shapes.Current state
The core parser built in #1 is explicitly scoped to a subset of OpenAPI (see #1's "explicitly out of scope" list):
allOf/oneOf/anyOf/discriminator resolution is called out there as deferred. This issue is where that deferred work actually gets scoped and built once there's a concrete need for it (most likely driven by #10's schema synthesis hitting a composed schema and not knowing what to do with it).What to build
allOf: merge all member schemas' properties into one effective schema.oneOf/anyOfwithout adiscriminator: pick a strategy for which variant to use when synthesizing (Dependency Dashboard #10) — likely "first declared variant" is a reasonable default, since there's no runtime data to disambiguate at spec-parse time.oneOfwith adiscriminator: resolvediscriminator.propertyNameanddiscriminator.mappingto determine which variant a given example or synthesized value actually represents.This is meaningfully more complex than the rest of the parser (#1) — JSON Schema composition has real edge cases (conflicting property definitions across
allOfmembers, circular refs, etc.). Scope the first pass narrowly (handle the common, well-formed cases; fail loudly rather than silently misinterpreting on anything unusual) rather than attempting full JSON Schema spec conformance.Acceptance criteria
allOfmember schemas are merged correctly for the common case (non-conflicting properties).oneOf/anyOfwithout a discriminator falls back to a documented, deterministic strategy.oneOfwith a discriminator resolves to the correct variant given adiscriminator.propertyNamevalue.allOfmembers) fails with a clear error rather than silently producing a wrong result.Files likely touched
devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/openapi/)