def test_circular_referencing_schemas(self, spec): spec.components.schema("Analysis", schema=AnalysisSchema) spec.components.schema("Sample", schema=SampleSchema) spec.components.schema("Run", schema=RunSchema) definitions = get_definitions(spec) ref = definitions["Analysis"]["properties"]["sample"]["$ref"] assert ref == ref_path(spec) + "tests.test_ext_serpyco.SampleSchema"
def test_self_referencing_field_many(self, spec): spec.components.schema("SelfReference", schema=SelfReferencingSchema) definitions = get_definitions(spec) result = definitions["SelfReference"]["properties"]["many"] assert result == { "type": "array", "items": { "$ref": ref_path(spec) + "SelfReference" }, }
def test_self_referencing_field_single(self, spec): spec.components.schema("SelfReference", schema=SelfReferencingSchema) definitions = get_definitions(spec) ref = definitions["SelfReference"]["properties"]["single"]["$ref"] assert ref == ref_path(spec) + "SelfReference"