We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be good to have support for enum defined at components/schemas level and used in data models by $ref
Files.FileLocation: type: string enum: - deleted - location1 - location2 Files.FileUploadReply: type: object properties: location: $ref: '#/components/schemas/Files.FileLocation' filename: type: string
class FilesFileLocation(OpenApiObject): DELETED = "deleted" # type: str LOCATION1 = "location1" # type: str LOCATION2 = "location2" # type: str class FilesFileUploadReply(OpenApiObject): _TYPES = { "location": { "type": str, "enum": [ "deleted" "location1", "location2" ], } } @property def location(self): # type: -> Union[Listeral["deleted"],Literal["location1"],Literal["location2"]] return self._get_property("location") @location.setter def location(self, value): # type: (Union[Listeral["deleted"],Literal["location1"],Literal["location2"]]) self._set_property("location", value)
upload_reply = FilesFileUploadReply() upload_reply.location = FilesFileLocation.LOCATION1 assert upload_reply.location == FilesFileLocation.LOCATION1
The text was updated successfully, but these errors were encountered:
This is already supported. OpenAPIArt uses x-include to specifically inline code as opposed to $ref which expects global objects.
global objects
Declare the global enum as follows:
Files.FileLocation: type: string enum: - deleted - location1 - location2
Inline the enum where needed in the model using the x-include extension.
Object1: type: object properties: global_enum_1: x-include: - '#/components/schemas/Files.FileLocation' Object2: type: object properties: global_enum_2: x-include: - '#/components/schemas/Files.FileLocation'
SDK code will be generated on a per attribute basis.
Sorry, something went wrong.
ajbalogh
No branches or pull requests
It would be good to have support for enum defined at components/schemas level and used in data models by $ref
Global Enum model
Generated Python
Sample usage
The text was updated successfully, but these errors were encountered: