You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see two classes of these allOf uses: adding a description field and adding a nullable field.
In both cases, the use of allOf is necessary to add the additional field because in JSON Schema Draft 7 a $ref must be alone in an object. OpenAPI 3.0.x (which we're using) is based on JSON draft 7. OpenAPI 3.1 is based on a later draft which has greater flexibility, but the tooling ecosystem seems to be anaemic--more so than 3.0.x.
For description we need this in situations where the parameter itself is documented. I don't think this can be avoided without removing important information from the schema.
The nullable case may be avoidable, but I'm not certain of the right approach. Consider the case above of OrganizationUpdate which is really just a (flattened) wrapper around IdentityMetadataUpdateParams:
Both of these properties are optional and we can see this in the schema because neither of them is in the set of required properties. By default null is a valid value for an Option type. We could change our use of schemars so that it doesn't generate the nullable property, and that would certainly lead to a simpler spec, but since we do actually accept null as a valid value for these, we may want to preserve that expressivity.
Is the use of allOf somehow impeding you? Is this causing problems with a generator?
It's not causing me any problems, it's an easy case to handle — at least in our case where there's just one arm to the allOf. I just noticed it in the spec and didn't understand why it was there. Now I do. Thanks for the explanation!
Some of the PUT body ones might go away because of #333, but not all.
Glad to hear that it's not an obstacle. I agree that it's goofy! And it's good at least that if/when we go to OpenAPI 3.1 we won't have to deal with it.
Activity
ahl commentedon Jan 19, 2022
I see two classes of these
allOfuses: adding adescriptionfield and adding anullablefield.In both cases, the use of
allOfis necessary to add the additional field because in JSON Schema Draft 7 a$refmust be alone in an object. OpenAPI 3.0.x (which we're using) is based on JSON draft 7. OpenAPI 3.1 is based on a later draft which has greater flexibility, but the tooling ecosystem seems to be anaemic--more so than 3.0.x.For
descriptionwe need this in situations where the parameter itself is documented. I don't think this can be avoided without removing important information from the schema.The
nullablecase may be avoidable, but I'm not certain of the right approach. Consider the case above ofOrganizationUpdatewhich is really just a (flattened) wrapper aroundIdentityMetadataUpdateParams:Both of these properties are optional and we can see this in the schema because neither of them is in the set of required properties. By default
nullis a valid value for anOptiontype. We could change our use ofschemarsso that it doesn't generate thenullableproperty, and that would certainly lead to a simpler spec, but since we do actually acceptnullas a valid value for these, we may want to preserve that expressivity.Is the use of
allOfsomehow impeding you? Is this causing problems with a generator?david-crespo commentedon Jan 19, 2022
It's not causing me any problems, it's an easy case to handle — at least in our case where there's just one arm to the
allOf. I just noticed it in the spec and didn't understand why it was there. Now I do. Thanks for the explanation!Some of the PUT body ones might go away because of #333, but not all.
ahl commentedon Jan 19, 2022
Glad to hear that it's not an obstacle. I agree that it's goofy! And it's good at least that if/when we go to OpenAPI 3.1 we won't have to deal with it.
Update crucible and propolis versions
Update crucible and propolis versions (#4912)