CCF
CCF copied to clipboard
OpenAPI suggests that "operationId" (or "operationref") is mandatory.
nt
From https://swagger.io/specification/:
In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL.
The description for operationId is under https://swagger.io/specification/:
Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.
There is no mention of REQUIRED, and although the unicity is a MUST, there is no explicit statement about existence. Issues on the OpenAPI repository (#1019, #1907) asking for it be made mandatory have been rejected, and clarify that it is not mandatory.
This next bit is my opinion: there is no valid reason to demand that someone manually writes an operationId, creating one from the path/verb is trivial to automate correctly. It is bizarre that the SDK generators are both demanding this manual de-normalisation while complaining about duplicates.
Anyway, there is clearly no downside to having this, thank you for adding it.
To fix the tests (I tried to do, but I can't seem to write to your fork), it is necessary to:
- rev up
openapi_info.document_versioninsrc/node/rpc/node_frontend.h,src/node/rpc/member_frontend.handsamples/app/logging/logging.cpp(I suggest +0.1.0in this case, but any amount will work). - re-build
- re-run the schema test
./tests.sh -VV -R schemawhich will produce the new OpenAPI schemas (it will fail, but that's ok) - commit them
I tried to do, but I can't seem to write to your fork
You and the others should have collaborator permissions in my fork:
@lemmy weird, tried again and it worked. Tests should pass now.
Using the verb concatenated with the camel-cased path appears to be a common default. For example, the verb delete combined with the path app/log/private/all becomes the operationId DeleteAppLogPrivateAll. Does the CCF codebase have a built-in function for converting a string to camel case?
Does the CCF codebase have a built-in function for converting a string to camel case?
No, though it's easy enough to add. Proposed impl is here: #6349, let me know if that works for you and we'll get it merged.