Skip to content

Commit

Permalink
Merge pull request #1002 from appwrite/revert-885-883-fix-enum-casings
Browse files Browse the repository at this point in the history
Revert "Fix Enum Casings For Swift & Dart"
  • Loading branch information
abnegate authored Nov 6, 2024
2 parents 1a2731f + 3d7dd3f commit ff4a0cc
Show file tree
Hide file tree
Showing 20 changed files with 5 additions and 51 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ docker run --rm -v $(pwd):$(pwd):rw -w $(pwd) -v /var/run/docker.sock:/var/run/d
* **description** -> Description of Appwrite SDK
* **namespace** -> SDK Namespace
* **version** -> SDK Version
* **endpoint** -> Default Endpoint (example: "https://cloud.appwrite.io/v1")
* **host** -> Default Host (example: "cloud.appwrite.io")
* **endpoint** -> Default Endpoint (example: "https://appwrite.io/v1")
* **host** -> Default Host (example: "appwrite.io")
* **basePath** -> Default Path to API (example: "/v1")
* **licenseName** -> Name of license for SDK
* **licenseURL** -> URL to SDK license
Expand Down
2 changes: 1 addition & 1 deletion mock-server/app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
->label('sdk.method', 'enum')
->label('sdk.description', 'Mock an enum parameter.')
->label('sdk.mock', true)
->param('mockType', '', new WhiteList(['first', 'second', 'third', 'FOURTH']), 'Sample enum param')
->param('mockType', '', new WhiteList(['first', 'second', 'third']), 'Sample enum param')
->action(function (string $mockType) {
});

Expand Down
1 change: 0 additions & 1 deletion src/SDK/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ protected function toCamelCase($str): string

$str = \preg_replace('/[^a-zA-Z0-9]+/', ' ', $str);
$str = \trim($str);
$str = strtolower($str);
$str = \ucwords($str);
$str = \str_replace(' ', '', $str);
$str = \lcfirst($str);
Expand Down
3 changes: 1 addition & 2 deletions tests/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ abstract class Base extends TestCase
];

protected const ENUM_RESPONSES = [
'POST:/v1/mock/tests/general/enum:passed', // first enum
'POST:/v1/mock/tests/general/enum:passed', // fourth enum
'POST:/v1/mock/tests/general/enum:passed',
];

protected const UPLOAD_RESPONSE = [
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/android/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ class ServiceTest {
mock = general.enum(MockType.FIRST)
writeToFile(mock.result)

mock = general.enum(MockType.FOURTH)
writeToFile(mock.result)

try {
general.error400()
} catch (e: AppwriteException) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/apple/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ class Tests: XCTestCase {
mock = try await general.xenum(mockType: .first)
print(mock.result)

mock = try await general.xenum(mockType: .fourth)
print(mock.result)

do {
try await general.error400()
} catch {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/dart/tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ void main() async {
response = await general.xenum(mockType: MockType.first);
print(response.result);

response = await general.xenum(mockType: MockType.fourth);
print(response.result);

try {
await general.error400();
} on AppwriteException catch (e) {
Expand Down
4 changes: 0 additions & 4 deletions tests/languages/deno/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ async function start() {
// @ts-ignore
console.log(response.result);

response = await general.enum(appwrite.MockType.Fourth);
// @ts-ignore
console.log(response.result);

try {
response = await general.error400();
} catch (error) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/dotnet/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ public async Task Test1()
mock = await general.Enum(MockType.First);
TestContext.WriteLine(mock.Result);

mock = await general.Enum(MockType.Fourth);
TestContext.WriteLine(mock.Result);

try
{
await general.Error400();
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/flutter/tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ void main() async {
response = await general.xenum(mockType: MockType.first);
print(response.result);

response = await general.xenum(mockType: MockType.fourth);
print(response.result);

try {
await general.error400();
} on AppwriteException catch (e) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/kotlin/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ class ServiceTest {
mock = general.enum(MockType.FIRST)
writeToFile(mock.result)

mock = general.enum(MockType.FOURTH)
writeToFile(mock.result)

try {
general.error400()
} catch (e: AppwriteException) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/node/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ async function start() {
response = await general.enum(MockType.First);
console.log(response.result);

response = await general.enum(MockType.Fourth);
console.log(response.result);

try {
response = await general.error400();
} catch(error) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/php/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@
$response = $general->enum(MockType::FIRST());
echo "{$response['result']}\n";

$response = $general->enum(MockType::FOURTH());
echo "{$response['result']}\n";

try {
$response = $general->error400();
} catch (AppwriteException $e) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/python/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@
response = general.enum(MockType.FIRST)
print(response['result'])

response = general.enum(MockType.FOURTH)
print(response['result'])

try:
response = general.error400()
except AppwriteException as e:
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/ruby/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
response = general.enum(mock_type: MockType::FIRST)
puts response.result

response = general.enum(mock_type: MockType::FOURTH)
puts response.result

begin
general.error400()
rescue Exception => error
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/swift/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ class Tests: XCTestCase {
mock = try await general.xenum(mockType: .first)
print(mock.result)

mock = try await general.xenum(mockType: .fourth)
print(mock.result)

do {
try await general.error400()
} catch {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@
response = await general.enum(MockType.First);
console.log(response.result);

response = await general.enum(MockType.Fourth);
console.log(response.result);

try {
response = await general.empty();
} catch (error) {
Expand Down
3 changes: 0 additions & 3 deletions tests/languages/web/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ async function start() {
response = await general.enum(MockType.First);
console.log(response.result);

response = await general.enum(MockType.Fourth);
console.log(response.result);

try {
response = await general.empty();
} catch (error) {
Expand Down
Empty file modified tests/languages/web/tests.js
100755 → 100644
Empty file.
3 changes: 1 addition & 2 deletions tests/resources/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1301,8 +1301,7 @@
"enum": [
"first",
"second",
"third",
"FOURTH"
"third"
],
"x-enum-name": null,
"x-enum-keys": []
Expand Down

0 comments on commit ff4a0cc

Please sign in to comment.