Constants as openapi const#1086
Conversation
|
I'm wondering, is this PR AI-assisted?? I don't understand why this pr introduces so much changes across all subsystems (type inference, open api generation, configuration) while the only thing it should do is to use |
|
No, no AI was involved. I tried to figure out how to do it by following the EnumCaseType's lifecycle. The configuration was just a plus, since I thought it could be an unnecessary or even unwanted feature for some developers. If you have any suggestion to make it better, I'd be glad to update the PR. |
|
@apasquini95 gotcha. I believe that this PR should be only concerned with 2 things: 1) add I see you also attempted changing how class consts fetching work, but there is no need for it. And if in some context it doesn't work, it is a completely different issue then. |
|
Ok, I'll make another attempt thanks :) What about the configuration flag? Do you think it is unnecessary? |
|
@apasquini95 nah, I'd rather just go for it. |
|
@apasquini95 thanks! |
As mentioned in #1015, the OpenApi 3.1 standard allows to declare constant values with the
constsyntax, instead of using the single-valueenumschema. This can improve openapi readability and parsers' interpretation of it.This merge request allows the developer to use this feature, that can be enabled by toggling the
scramble.class_constants_as_constconfig value.