def convert_expectations(self, schema_obj: SchemaDefinition) -> SchemaDefinition: """ Method for converting the supported specifications to great expectation format """ if schema_obj.is_empty(): return schema_obj content = schema_obj.get_content() if self.get_property_keyword() not in content: return schema_obj self.convert_expectations_recursive(content) return SchemaDefinition.create(json.dumps(content), schema_obj.is_schema_inferred)
def parse_schema(self, schema_definition: SchemaDefinition) -> SchemaParserResult: """ Template method """ # execute preprocessing step schema_definition = self.convert_expectations(schema_definition) schema_content = schema_definition.get_content() # load types from schema type_definitions, expectation_definitions = self.load_types_from_schema(schema_content) # load required types from schema required_types, type_expectations = self.load_required_types_from_schema(schema_content) return SchemaParserResult(type_definitions, expectation_definitions, required_types, type_expectations)