Merge pull request #10553 from appwrite/update-platform-type

fix: enum typing for platform in specs
This commit is contained in:
Jake Barnby 2025-09-26 20:06:53 +12:00 committed by GitHub
commit cf92c259ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 72 additions and 19 deletions

View file

@ -25153,7 +25153,7 @@
"properties": {
"type": {
"type": "string",
"description": "Platform type.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"x-example": "web",
"enum": [
"web",
@ -53440,16 +53440,24 @@
},
"type": {
"type": "string",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, ios, android, and unity.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"x-example": "web",
"enum": [
"web",
"flutter-web",
"flutter-ios",
"flutter-android",
"ios",
"flutter-linux",
"flutter-macos",
"flutter-windows",
"apple-ios",
"apple-macos",
"apple-watchos",
"apple-tvos",
"android",
"unity"
"unity",
"react-native-ios",
"react-native-android"
]
},
"key": {

View file

@ -25153,7 +25153,7 @@
"properties": {
"type": {
"type": "string",
"description": "Platform type.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"x-example": "web",
"enum": [
"web",
@ -53440,16 +53440,24 @@
},
"type": {
"type": "string",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, ios, android, and unity.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"x-example": "web",
"enum": [
"web",
"flutter-web",
"flutter-ios",
"flutter-android",
"ios",
"flutter-linux",
"flutter-macos",
"flutter-windows",
"apple-ios",
"apple-macos",
"apple-watchos",
"apple-tvos",
"android",
"unity"
"unity",
"react-native-ios",
"react-native-android"
]
},
"key": {

View file

@ -25305,7 +25305,7 @@
"properties": {
"type": {
"type": "string",
"description": "Platform type.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"default": null,
"x-example": "web",
"enum": [
@ -53396,16 +53396,24 @@
},
"type": {
"type": "string",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, ios, android, and unity.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"x-example": "web",
"enum": [
"web",
"flutter-web",
"flutter-ios",
"flutter-android",
"ios",
"flutter-linux",
"flutter-macos",
"flutter-windows",
"apple-ios",
"apple-macos",
"apple-watchos",
"apple-tvos",
"android",
"unity"
"unity",
"react-native-ios",
"react-native-android"
]
},
"key": {

View file

@ -25305,7 +25305,7 @@
"properties": {
"type": {
"type": "string",
"description": "Platform type.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"default": null,
"x-example": "web",
"enum": [
@ -53396,16 +53396,24 @@
},
"type": {
"type": "string",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, ios, android, and unity.",
"description": "Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.",
"x-example": "web",
"enum": [
"web",
"flutter-web",
"flutter-ios",
"flutter-android",
"ios",
"flutter-linux",
"flutter-macos",
"flutter-windows",
"apple-ios",
"apple-macos",
"apple-watchos",
"apple-tvos",
"android",
"unity"
"unity",
"react-native-ios",
"react-native-android"
]
},
"key": {

View file

@ -1756,7 +1756,28 @@ App::post('/v1/projects/:projectId/platforms')
]
))
->param('projectId', '', new UID(), 'Project unique ID.')
->param('type', null, new WhiteList([Platform::TYPE_WEB, Platform::TYPE_FLUTTER_WEB, Platform::TYPE_FLUTTER_IOS, Platform::TYPE_FLUTTER_ANDROID, Platform::TYPE_FLUTTER_LINUX, Platform::TYPE_FLUTTER_MACOS, Platform::TYPE_FLUTTER_WINDOWS, Platform::TYPE_APPLE_IOS, Platform::TYPE_APPLE_MACOS, Platform::TYPE_APPLE_WATCHOS, Platform::TYPE_APPLE_TVOS, Platform::TYPE_ANDROID, Platform::TYPE_UNITY, Platform::TYPE_REACT_NATIVE_IOS, Platform::TYPE_REACT_NATIVE_ANDROID], true), 'Platform type.')
->param(
'type',
null,
new WhiteList([
Platform::TYPE_WEB,
Platform::TYPE_FLUTTER_WEB,
Platform::TYPE_FLUTTER_IOS,
Platform::TYPE_FLUTTER_ANDROID,
Platform::TYPE_FLUTTER_LINUX,
Platform::TYPE_FLUTTER_MACOS,
Platform::TYPE_FLUTTER_WINDOWS,
Platform::TYPE_APPLE_IOS,
Platform::TYPE_APPLE_MACOS,
Platform::TYPE_APPLE_WATCHOS,
Platform::TYPE_APPLE_TVOS,
Platform::TYPE_ANDROID,
Platform::TYPE_UNITY,
Platform::TYPE_REACT_NATIVE_IOS,
Platform::TYPE_REACT_NATIVE_ANDROID,
], true),
'Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.'
)
->param('name', null, new Text(128), 'Platform name. Max length: 128 chars.')
->param('key', '', new Text(256), 'Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.', true)
->param('store', '', new Text(256), 'App store or Google Play store ID. Max length: 256 chars.', true)

View file

@ -41,10 +41,10 @@ class Platform extends Model
])
->addRule('type', [
'type' => self::TYPE_ENUM,
'description' => 'Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, ios, android, and unity.',
'description' => 'Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.',
'default' => '',
'example' => 'web',
'enum' => ['web', 'flutter-web', 'flutter-ios', 'flutter-android', 'ios', 'android', 'unity'],
'enum' => ['web', 'flutter-web', 'flutter-ios', 'flutter-android', 'flutter-linux', 'flutter-macos', 'flutter-windows', 'apple-ios', 'apple-macos', 'apple-watchos', 'apple-tvos', 'android', 'unity', 'react-native-ios', 'react-native-android'],
])
->addRule('key', [
'type' => self::TYPE_STRING,