Class OneOfImplementorAdditionalData


  • public class OneOfImplementorAdditionalData
    extends Object
    This class holds data to add to `oneOf` members. Let's consider this example: Foo: properties: x: oneOf: - $ref: "#/components/schemas/One - $ref: "#/components/schemas/Two y: type: string One: properties: z: type: string Two: properties: a: type: string In codegens that use this mechanism, `Foo` will become an interface and `One` will become its implementing class. This class carries all data necessary to properly modify the implementing class model. Specifically: * Interfaces that the implementing classes have to implement (in the example above, `One` and `Two` will implement `Foo`) * Properties that need to be added to implementing classes (as `Foo` is interface, the `y` property will get pushed to implementing classes `One` and `Two`) * Imports that need to be added to implementing classes (e.g. if type of property `y` needs a specific import, it needs to be added to `One` and `Two` because of the above point)
    • Constructor Detail

      • OneOfImplementorAdditionalData

        public OneOfImplementorAdditionalData​(String implementorName)
    • Method Detail

      • getImplementorName

        public String getImplementorName()
      • addFromInterfaceModel

        public void addFromInterfaceModel​(CodegenModel cm,
                                          List<Map<String,​String>> modelsImports)
        Add data from a given CodegenModel that the oneOf implementor should implement. For example:
        Parameters:
        cm - model that the implementor should implement
        modelsImports - imports of the given `cm`
      • addToImplementor

        public void addToImplementor​(CodegenConfig cc,
                                     CodegenModel implcm,
                                     List<Map<String,​String>> implImports,
                                     boolean addInterfaceImports)
        Adds stored data to given implementing model
        Parameters:
        cc - CodegenConfig running this operation
        implcm - the implementing model
        implImports - imports of the implementing model
        addInterfaceImports - whether or not to add the interface model as import (will vary by language)