fix: Block duplicate status code definitions#92
Conversation
Signed-off-by: provokateurin <kate@provokateurin.de>
|
|
Ah, that's "implicit", one 500 is documented as it's returned, one is automatic because it's from an exception |
|
I see, also the error message is wrong because it should have shown the status code and not the number of times it appears. |
|
For the failure seen in the CI the cause wasn't the 500s, but this PR can't actually work for scenarios where multiple different response classes are used like in https://github.com/nextcloud/server/blob/489608a2238a62409eb2305a2aee621d6bd774b6/apps/theming/lib/Controller/IconController.php#L117. |
Duplicate status code definitions lead to invalid specs (https://github.com/julien-nc/cospend-nc/blob/76964a296fd1a22aabf147e3fec5dec0b48fd4eb/openapi.json#L7939) because they can not be merged automatically. Therefore we need to prevent people from defining a status code twice. IMO this also lines up with HTTP semantics were one status code always means a specific body and set of headers is returned. It is up to the developer to specify the body and header types correctly (e.g. nullability).