Class OpenAPIGeneratorOptions
java.lang.Object
org.brapi.schematools.core.options.AbstractGeneratorOptions
org.brapi.schematools.core.openapi.generator.options.OpenAPIGeneratorOptions
- All Implemented Interfaces:
Options,Validatable
Options for the
OpenAPIGenerator.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringgetListResponseNameFor(@NonNull String name) Gets the name for the List Response for a specific Primary Modelfinal StringgetListResponseNameFor(@NonNull BrAPIType type) Gets the name for the List Response for a specific Primary Modelfinal StringgetListResponseNameFor(@NonNull BrAPIObjectTypeWithProperty typeWithProperty) Gets the name for the List Response for a specific Primary ModelgetNewRequestNameFor(@NonNull String name) Gets the name for the NewRequest schema for a specific Primary Modelfinal StringgetNewRequestNameFor(@NonNull BrAPIType type) Gets the name for the NewRequest schema for a specific Primary ModelgetPathItemNameFor(String name) Gets the path item name for a specific Primary ModelgetPathItemNameFor(BrAPIType type) Gets the path item name for a specific Primary Modelfinal StringgetPathItemNameForProperty(@NonNull String typeName, @NonNull String propertyName) Gets the path item name for a specific BrAPI Propertyfinal StringgetPathItemNameForProperty(@NonNull BrAPIType type, @NonNull BrAPIObjectProperty property) Gets the path item name for a specific BrAPI PropertygetPathItemNameForProperty(@NonNull BrAPIObjectTypeWithProperty typeWithProperty) Gets the path item name for a specific BrAPI PropertyGets the path item with id name for a specific Primary Modelfinal StringgetSearchRequestNameFor(@NonNull String name) Gets the name for the Search Request schema for a specific Primary Modelfinal StringgetSearchRequestNameFor(@NonNull BrAPIType type) Gets the name for the Search Request schema for a specific Primary ModelgetSingleResponseNameFor(@NonNull String name) Gets the name for the Single Response schema for a specific Primary Modelfinal StringgetSingleResponseNameFor(@NonNull BrAPIType type) Gets the name for the Single Response schema for a specific Primary Modelfinal StringgetSingularForProperty(@NonNull String propertyName) Gets the singular name for pluralised property namegetSubPathItemNameFor(String pathItemName, BrAPIObjectProperty property) Gets the name of the Sub-path endpoint for a propertygetSupplementalSpecificationFor(@NonNull String name) final StringGets the tag name for a specific Primary Model.final StringGets the tag name for a specific Primary Model.booleanDetermines Controlled vocabulary endpoints should be generated.booleanDetermines if the Generator should generate any Endpoints without an ID parameter.booleanisGeneratingEndpointFor(@NonNull String name) Determines if the Generator should generate the Endpoints without an ID parameter for a specific Primary Model.booleanisGeneratingEndpointFor(@NonNull BrAPIType type) Determines if the Generator should generate the Endpoints without an ID parameter for a specific Primary Model.booleanisGeneratingEndpointNameWithIdFor(@NonNull String name) Determines if the Generator should generate the Endpoints with an ID parameter for a specific Primary Model.final booleanisGeneratingEndpointNameWithIdFor(@NonNull BrAPIType type) Determines if the Generator should generate the Endpoints with an ID parameter for a specific Primary Model.booleanDetermines if the Generator should generate any Endpoints with an ID parameter.booleanisGeneratingNewRequestFor(@NonNull String name) Determines if the Generator should generate a NewRequest schema, separate from the standard schema for a specific Primary Model.final booleanisGeneratingNewRequestFor(@NonNull BrAPIType type) Determines if the Generator should generate a NewRequest schema, separate from the standard schema for a specific Primary Model.booleanisGeneratingSubPathFor(BrAPIObjectType type, BrAPIObjectProperty property) Determines if a specific property should be exposed as a separate EndpointbooleanDetermines if the Generator should generate a separate specification per module.static OpenAPIGeneratorOptionsload()Load the default optionsstatic OpenAPIGeneratorOptionsload(InputStream inputStream) Load the options from an options input stream in YAML or Json.static OpenAPIGeneratorOptionsLoad the options from an options file in YAML or Json.override(OpenAPIGeneratorOptions overrideOptions) Overrides the values in this Options Object from the provided Options Object if they are non-nullsetPathItemNameForProperty(String typeName, String propertyName, String pathItemName) Sets the path item name for a specific BrAPI PropertysetPathItemNameForProperty(@NonNull BrAPIType type, @NonNull BrAPIObjectProperty property, String pathItemName) Sets the path item name for a specific BrAPI PropertySets the tag name for a specific primary model.validate()Checks if the Validatable object is valid, return a list of errors if it is not validMethods inherited from class org.brapi.schematools.core.options.AbstractGeneratorOptions
getPluralFor, getPluralFor, override, setPluralForMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.brapi.schematools.core.options.Options
getSchemaToolsVersion
-
Constructor Details
-
OpenAPIGeneratorOptions
public OpenAPIGeneratorOptions()
-
-
Method Details
-
load
Load the default options- Returns:
- The default options
-
load
Load the options from an options file in YAML or Json. The options file may have missing (defined) values, in these cases the default values are loaded. Seeload()- Parameters:
optionsFile- The path to the options file in YAML or Json.- Returns:
- The options loaded from the YAML or Json file.
- Throws:
IOException- if the options file can not be found or is incorrectly formatted.
-
load
Load the options from an options input stream in YAML or Json. The options file may have missing (defined) values, in these cases the default values are loaded. Seeload()- Parameters:
inputStream- The input stream in YAML or Json.- Returns:
- The options loaded from input stream.
- Throws:
IOException- if the input stream is not valid or the content is incorrectly formatted.
-
override
Overrides the values in this Options Object from the provided Options Object if they are non-null- Parameters:
overrideOptions- the options which will be used to override this Options Object- Returns:
- this object for method chaining
-
validate
Description copied from interface:ValidatableChecks if the Validatable object is valid, return a list of errors if it is not valid- Returns:
- a Validation object than can be used queried to find if the object is valid and any errors if it is not valid
-
isSeparatingByModule
public boolean isSeparatingByModule()Determines if the Generator should generate a separate specification per module.- Returns:
trueif the Generator should generate a separate specification per module,falseotherwise
-
isGeneratingEndpoint
public boolean isGeneratingEndpoint()Determines if the Generator should generate any Endpoints without an ID parameter. ReturnstrueifAbstractGeneratorSubOptions.isGenerating()orAbstractGeneratorSubOptions.isGenerating()orAbstractGeneratorSubOptions.isGenerating()is set totrue- Returns:
trueif the Generator should generate any Endpoints without an ID parameter,falseotherwise
-
isGeneratingEndpointFor
Determines if the Generator should generate the Endpoints without an ID parameter for a specific Primary Model. ReturnstrueifAbstractGeneratorSubOptions.isGeneratingFor(String)orAbstractGeneratorSubOptions.isGeneratingFor(String)is set totrue- Parameters:
name- the name of the Primary Model- Returns:
trueif the Generator should generate the Endpoints without an ID parameter for a specific Primary Model,falseotherwise
-
isGeneratingEndpointFor
Determines if the Generator should generate the Endpoints without an ID parameter for a specific Primary Model. ReturnstrueifAbstractGeneratorSubOptions.isGeneratingFor(String)orAbstractGeneratorSubOptions.isGeneratingFor(String)is set totrue- Parameters:
type- the Primary Model- Returns:
trueif the Generator should generate the Endpoints without an ID parameter for a specific Primary Model,falseotherwise
-
isGeneratingEndpointWithId
public boolean isGeneratingEndpointWithId()Determines if the Generator should generate any Endpoints with an ID parameter. ReturnstrueifAbstractGeneratorSubOptions.isGenerating()orAbstractGeneratorSubOptions.isGenerating()orAbstractGeneratorSubOptions.isGenerating()is set totrue- Returns:
trueif the Generator should generate any Endpoints without an ID parameter,falseotherwise
-
isGeneratingEndpointNameWithIdFor
Determines if the Generator should generate the Endpoints with an ID parameter for a specific Primary Model. ReturnstrueifAbstractGeneratorSubOptions.isGeneratingFor(String)orPutOptions.isGeneratingEndpointNameWithIdFor(String)orAbstractGeneratorSubOptions.isGeneratingFor(String)is set totrue- Parameters:
name- the name of the Primary Model- Returns:
trueif the Generator should generate the Endpoints with an ID parameter for a specific Primary Model,falseotherwise
-
isGeneratingEndpointNameWithIdFor
Determines if the Generator should generate the Endpoints with an ID parameter for a specific Primary Model. ReturnstrueifAbstractGeneratorSubOptions.isGeneratingFor(String)orPutOptions.isGeneratingEndpointNameWithIdFor(String)orAbstractGeneratorSubOptions.isGeneratingFor(String)is set totrue- Parameters:
type- the Primary Model- Returns:
trueif the Generator should generate the Endpoints with an ID parameter for a specific Primary Model,falseotherwise
-
getSupplementalSpecificationFor
-
isGeneratingNewRequestFor
Determines if the Generator should generate a NewRequest schema, separate from the standard schema for a specific Primary Model. For example if set totruefor the model 'Study' the generator will create the NewStudyRequest schema and the 'Study' schema, whereas if setfalsegenerator will create only create the 'Study' schema- Parameters:
name- the name of the Primary Model- Returns:
trueif the Generator should generate a NewRequest schema, separate from the standard schema for a specific Primary Model,falseotherwise
-
isGeneratingNewRequestFor
Determines if the Generator should generate a NewRequest schema, separate from the standard schema for a specific Primary Model. For example if set totruefor the model 'Study' the generator will create the NewStudyRequest schema and the 'Study' schema, whereas if setfalsegenerator will create only create the 'Study' schema- Parameters:
type- the Primary Model- Returns:
trueif the Generator should generate a NewRequest schema, separate from the standard schema for a specific Primary Model,falseotherwise
-
getNewRequestNameFor
Gets the name for the NewRequest schema for a specific Primary Model- Parameters:
name- the name of the Primary Model- Returns:
- the NewRequest schema name for a specific Primary Model
-
getNewRequestNameFor
Gets the name for the NewRequest schema for a specific Primary Model- Parameters:
type- the Primary Model- Returns:
- the NewRequest schema name for a specific Primary Model
-
getSingleResponseNameFor
Gets the name for the Single Response schema for a specific Primary Model- Parameters:
name- the name of the Primary Model- Returns:
- the Single Response schema name for a specific Primary Model
-
getSingleResponseNameFor
Gets the name for the Single Response schema for a specific Primary Model- Parameters:
type- the Primary Model- Returns:
- the Single Response schema name for a specific Primary Model
-
getListResponseNameFor
Gets the name for the List Response for a specific Primary Model- Parameters:
name- the name of the Primary Model- Returns:
- the List Response name for a specific Primary Model
-
getListResponseNameFor
Gets the name for the List Response for a specific Primary Model- Parameters:
type- the Primary Model- Returns:
- the List Response name for a specific Primary Model
-
getListResponseNameFor
public final String getListResponseNameFor(@NonNull @NonNull BrAPIObjectTypeWithProperty typeWithProperty) Gets the name for the List Response for a specific Primary Model- Parameters:
typeWithProperty- the Primary Model and the Property- Returns:
- the List Response name for a specific Primary Model
-
getSearchRequestNameFor
Gets the name for the Search Request schema for a specific Primary Model- Parameters:
name- the name of the Primary Model- Returns:
- the Search Request schema name for a specific Primary Model
-
getSearchRequestNameFor
Gets the name for the Search Request schema for a specific Primary Model- Parameters:
type- the Primary Model- Returns:
- the Search Request schema name for a specific Primary Model
-
getSingularForProperty
Gets the singular name for pluralised property name- Parameters:
propertyName- the pluralised property name- Returns:
- the Pluralise name for a specific Primary Model
-
getPathItemNameFor
Gets the path item name for a specific Primary Model- Parameters:
name- the name of the Primary Model- Returns:
- the Pluralised name for a specific Primary Model
-
getPathItemNameFor
Gets the path item name for a specific Primary Model- Parameters:
type- the Primary Model- Returns:
- the path item name for a specific Primary Model
-
getPathItemWithIdNameFor
Gets the path item with id name for a specific Primary Model- Parameters:
type- the Primary Model- Returns:
- the path item name for a specific Primary Model
-
getPathItemNameForProperty
public final String getPathItemNameForProperty(@NonNull @NonNull String typeName, @NonNull @NonNull String propertyName) Gets the path item name for a specific BrAPI Property- Parameters:
typeName- the name of the primary modelpropertyName- the name of the property- Returns:
- the path item name for the Property
-
getPathItemNameForProperty
public final String getPathItemNameForProperty(@NonNull @NonNull BrAPIType type, @NonNull @NonNull BrAPIObjectProperty property) Gets the path item name for a specific BrAPI Property- Parameters:
type- the primary modelproperty- the property- Returns:
- the path item name for the Property
-
getPathItemNameForProperty
public String getPathItemNameForProperty(@NonNull @NonNull BrAPIObjectTypeWithProperty typeWithProperty) Gets the path item name for a specific BrAPI Property- Parameters:
typeWithProperty- the primary model with the property- Returns:
- the path item name for the Property
-
setPathItemNameForProperty
public OpenAPIGeneratorOptions setPathItemNameForProperty(String typeName, String propertyName, String pathItemName) Sets the path item name for a specific BrAPI Property- Parameters:
typeName- the name of the primary modelpropertyName- the name of the propertypathItemName- the path item name- Returns:
- the options for chaining
-
setPathItemNameForProperty
public OpenAPIGeneratorOptions setPathItemNameForProperty(@NonNull @NonNull BrAPIType type, @NonNull @NonNull BrAPIObjectProperty property, String pathItemName) Sets the path item name for a specific BrAPI Property- Parameters:
type- the primary modelproperty- the propertypathItemName- the path item name- Returns:
- the options for chaining
-
getTagFor
Gets the tag name for a specific Primary Model. If not setAbstractGeneratorOptions.getPluralFor(String)will be used. UsesetTagFor(String, String)to override this value.- Parameters:
name- the name of the Primary Model- Returns:
- the tag name for a specific Primary Model
-
getTagFor
Gets the tag name for a specific Primary Model. If not setAbstractGeneratorOptions.getPluralFor(String)will be used. UsesetTagFor(String, String)to override this value.- Parameters:
type- the Primary Model- Returns:
- the tag name for a specific Primary Model
-
setTagFor
Sets the tag name for a specific primary model.- Parameters:
name- the name of the primary modeltagName- the tag name for a specific primary model.- Returns:
- the options for chaining
-
isGeneratingSubPathFor
Determines if a specific property should be exposed as a separate Endpoint- Parameters:
type- the Object typeproperty- the Object type property- Returns:
truegenerator will create a separate Endpoint for the property,falseotherwise
-
getSubPathItemNameFor
Gets the name of the Sub-path endpoint for a property- Parameters:
pathItemName- the path prefixproperty- the Object type property- Returns:
- the name of the Sub-path endpoint for a property
-
isGeneratingControlledVocabularyEndpoints
public boolean isGeneratingControlledVocabularyEndpoints()Determines Controlled vocabulary endpoints should be generated. Any entity which as a property that is indicated in the metadata that it returns a controlled vocabulary will have an endpoint generated in the format /{entity-plural}/{property-name-plural} for example /attributes/categories- Returns:
trueif controlled vocabulary endpoints should be generated
-