google-api-swift-client
google-api-swift-client copied to clipboard
Enhance code generation to support enum definitions in the "schemas" section of JSON
This commit introduces the ability to define enums in the "schemas" section of a JSON file. The code now has the capability to properly parse and handle enum definitions.
Example, we define a Role
as an enum
"schemas": {
……
"Role": {
"id": "Role",
"type": "string",
"default": "HARM_CATEGORY_UNSPECIFIED",
"enum": [
"user",
"assistant",
"function"
],
"enumDescriptions": [
"User",
"Chat Assistant",
"Func"
]
},
……
}
The generated code:
public enum Role: String, Codable, CaseIterable {
case user // User
case assistant // Chat Assistant
case function // Func
}
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge
label. Good luck human!
-- conventional-commit-lint bot https://conventionalcommits.org/