Closed SRetip closed 4 months ago
Thank you for this. I don't think we want to special-case a
$ref
and object-related data. Rather, this should work for a$ref
with anything else. In addition, extensive merge logic already exists. If you'd like further guidance, please let me know; otherwise I'll fix this as I have time.
Certainly. I appreciate your response. I would require further details. I would be grateful for any additional clarification you could provide on this matter.
I think the essence of this is going to be that we match a schema in which $ref is Some and other stuff might not be None, then do something like:
let schema_without_ref = SchemaObject { reference: None, .. schema.clone() }.into();
let schema_only_ref = SchemaObject { reference: reference.clone(), .. Default::default() };
let new_schema = merge_all([schema_without_ref, schema_only_ref], defs);
self.convert(new_schema ..)
Also, we'll want a test. Probably in merged-schemas.json.
I think the essence of this is going to be that we match a schema in which $ref is Some and other stuff might not be None, then do something like:
let schema_without_ref = SchemaObject { reference: None, .. schema.clone() }.into(); let schema_only_ref = SchemaObject { reference: reference.clone(), .. Default::default() }; let new_schema = merge_all([schema_without_ref, schema_only_ref], defs); self.convert(new_schema ..)
Also, we'll want a test. Probably in merged-schemas.json.
Hello, I have made the changes you had requested.
Please add a test.
I hope that's the test you mean the right one.
Close https://github.com/oxidecomputer/typify/issues/533 first case:
seckond case:
third case:
fourth case:
![image](https://github.com/oxidecomputer/typify/assets/56289352/e3775974-2a75-4562-bcea-0e0604ed7d29)