Class BrAPISchemaReader
java.lang.Object
org.brapi.schematools.core.brapischema.BrAPISchemaReader
Utility class for reading BrAPI JSON Schema.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates schema reader with a basicObjectMapperand V202012 JSonSchema version -
Method Summary
Modifier and TypeMethodDescriptionreadDirectories(Path schemaDirectory) Reads the schema module directories within a parent directory, and validates between schemas.readSchema(Path schemaPath, String module) Reads a single object type from an JSON schema.readSchema(Path path, String schema, String module) Reads a single object type from an JSON schema string.
-
Constructor Details
-
BrAPISchemaReader
public BrAPISchemaReader()Creates schema reader with a basicObjectMapperand V202012 JSonSchema version
-
-
Method Details
-
readDirectories
Reads the schema module directories within a parent directory, and validates between schemas. Each directory in the parent directory is a module and the JSON schemas in the directories are object types- Parameters:
schemaDirectory- the parent directory that holds all the module directories- Returns:
- a response containing a list of BrAPIClass with one type per JSON Schema or validation errors
-
readSchema
public Response<BrAPIClass> readSchema(Path schemaPath, String module) throws BrAPISchemaReaderException Reads a single object type from an JSON schema. If the JSON schema contain more than one type definition only the first is returned. There is no validation of referenced schemas- Parameters:
schemaPath- a JSON schema filemodule- the module in which the object resides- Returns:
- a response containing the BrAPIClass for this schema or validation errors
- Throws:
BrAPISchemaReaderException- if there is a problem reading the JSON schema
-
readSchema
public Response<List<BrAPIClass>> readSchema(Path path, String schema, String module) throws BrAPISchemaReaderException Reads a single object type from an JSON schema string. There is no validation of referenced schemas- Parameters:
path- the path of the schema is used to check references, if not supplied then validation is not performedschema- a JSON schema stringmodule- the module in which the object resides- Returns:
- a response containing the BrAPIClass for this schema or validation errors
- Throws:
BrAPISchemaReaderException- if there is a problem reading the JSON schema
-