Exists in RAML definition any naming convention for the values in a enum definition?
Looking for the same information in Open API, it seems in examples provided that the convention is lower case and in Google API or GIT Hub API, seems to be upper underscore definition.
Thanks
Anurag Sharma (Nagarro) Forum Ambassador
Hello @RAUL DEL RIO LOPEZ
RAML (RESTful API Modeling Language) and OpenAPI are both specifications for defining APIs. They provide ways to describe resources, methods, parameters, and responses so that both client-side and server-side developers have clear and standardized documentation. When it comes to enum naming conventions, neither RAML nor OpenAPI enforces a specific naming convention for enum values. The naming often relies on the conventions used within the organization or the specific use case.
However, here are some common practices:
Lowercase- As you observed, many examples in OpenAPI use lowercase for enum values. This might be influenced by some programming languages or JSON standards where lowercase is a common convention for string literals.
Example:
parameters:
name: status
in: query
schema:
type: string
enum: [active, inactive, archived]
Similarly you can use UPPER_SNAKE_CASE and Camel Case.
When deciding on a naming convention for your enum values in RAML or OpenAPI:
- Consistency is Key. Whatever convention you choose, be consistent across your API definitions. This helps consumers of your API understand and predict the possible values.