Class Oas31CompositionLowering
- java.lang.Object
-
- org.openapitools.codegen.languages.Oas31CompositionLowering
-
public final class Oas31CompositionLowering extends Object
Ordered composition lowering for the cpp-boost-beast client: builds the per-schemaOas31CompositionLowering.CompositionDescriptors (branch scan surfaces, validator ids, null capability, discriminator) before model processing, computes recursive allOf intersections into synthetic schemas, and lowers composed branch sets to C++ storage types (std::optional / std::variant / CompositionBranchValue / boost::json::value) per the ordered rules.The descriptor records (
Oas31CompositionLowering.CompositionDescriptorand friends) are public nested types so tests and template-facing maps keep using the same accessor surface. The class is deliberately stateless: every method takes its inputs as parameters, incl. the parsedopenAPIdocument and the component-schema index; the codegen keeps the compositionDescriptors / allOfIntersections indexes and the model-phase consumers (processComposedModelFromDescriptor, fromModel, template maps) — those mutate CodegenModel state and stay on the generator.Branch surfaces are scanned by
Oas31SchemaSurfaceAssertionScanner.scanSurfaceAssertions(io.swagger.v3.oas.models.media.Schema, io.swagger.v3.oas.models.OpenAPI, java.util.List<java.lang.String>, java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.lang.Object>, boolean); exceptions (UnsupportedSchemaAssertionException, AllOfRequiredUnsatisfiableException) live on the generator and are referenced through it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOas31CompositionLowering.AllOfIntersectionResult of recursively intersecting allOf contributor schemas.static classOas31CompositionLowering.CompositionBranchDescriptorDescribes a single branch within a composed schema.static classOas31CompositionLowering.CompositionDescriptorDescribes a composed schema (oneOf, anyOf, allOf) with its branches, preserving the original keyword and branch order after normalization.static classOas31CompositionLowering.DiscriminatorDescriptorDescribes an optional discriminator on a composed schema.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Map<String,Object>>buildDiscriminatorBranchIndex(Map<String,String> discMapping, List<Oas31CompositionLowering.CompositionBranchDescriptor> branches)Fallback variant: builds a list of {key, value} maps from explicit discriminator mapping entries only (used when the codegen model's full MappedModel set is unavailable).static List<Map<String,Object>>buildDiscriminatorBranchIndex(Set<CodegenDiscriminator.MappedModel> mappedModels, List<Oas31CompositionLowering.CompositionBranchDescriptor> branches)Builds a list of {key, value} maps from the full set of discriminator mapped models (explicit URI mappings + implicit component-name mappings) for template-iteration.
-
-
-
Method Detail
-
buildDiscriminatorBranchIndex
public static List<Map<String,Object>> buildDiscriminatorBranchIndex(Set<CodegenDiscriminator.MappedModel> mappedModels, List<Oas31CompositionLowering.CompositionBranchDescriptor> branches)
Builds a list of {key, value} maps from the full set of discriminator mapped models (explicit URI mappings + implicit component-name mappings) for template-iteration. Each entry maps a C++-escaped discriminator value to a composition branch index so the template can reorder candidate validation for diagnostics.Unresolvable mappings (where the model name does not match any branch resolved schema name) fail generation with a clear diagnostic per §8.
- Parameters:
mappedModels- the full set of discriminator mapped modelsbranches- the composition branch descriptors- Returns:
- list of {key, value} maps; non-empty when at least one mapping resolves to a valid branch
- Throws:
RuntimeException- when a mapping does not resolve to any branch
-
buildDiscriminatorBranchIndex
public static List<Map<String,Object>> buildDiscriminatorBranchIndex(Map<String,String> discMapping, List<Oas31CompositionLowering.CompositionBranchDescriptor> branches)
Fallback variant: builds a list of {key, value} maps from explicit discriminator mapping entries only (used when the codegen model's full MappedModel set is unavailable).- Parameters:
discMapping- the discriminator.value → target mappingbranches- the composition branch descriptors- Returns:
- list of {key, value} maps
-
-