Closed hminsky2002 closed 2 months ago
The root cause here is that these fields use allOf
in order to mark certain items as readonly
.
For instance: https://github.com/PhilanthropyDataCommons/service/blob/c1f7e8717beb727d622bfd4273aaae450ed68dce/src/openapi.json#L199-L206
The code gen is treating both of those as separate entities, and using & to combine them. One might think "oh, well, BaseField is narrower than any
so it should collapse to just BaseField
" but apparently not.
This is partly related to #854, which would prevent the need to use that pattern.
Unfortunately the components of the swagger ecosystem that add that & any
are not necessarily directly in our control. That said, I'll look into whether we can use a different pattern in our specification or if it's possible to update the code generation script.
OK! It looks like switching to this format does the trick (hat tip https://stackoverflow.com/questions/51402156/how-to-declare-a-ref-property-as-readonly-in-openapi-swagger)
"applicationFormField": {
"readOnly": true,
"allOf": [
{
"$ref": "#/components/schemas/ApplicationFormField"
}
]
},
While working on pdc front-end issue 705 I discovered that, currently, our @pdc-sdk allows for type 'any' in multiple different schemas.
Per my understanding of the sdk and a discussion with @slifty in front-end PR 719, it seems like these are erroneous and should be fixed to be only of a specific type!