Skip to content

Commit ed3b42b

Browse files
author
Vincent (Wen Yu) Ge
committed
Agency grammar review for sdk generator
1 parent 3a0b829 commit ed3b42b

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

CONTRIBUTING.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Help us keep Appwrite open and inclusive. Please read and follow our [Code of Co
88

99
## Installation
1010

11-
To install a working development environment follow these instructions:
11+
To install a working development environment, please follow these instructions:
1212

1313
1. Fork or clone the appwrite/sdk-generator repository.
1414

@@ -33,7 +33,7 @@ docker run --rm --interactive --tty --volume "%cd%":/app composer update --ignor
3333

3434
3. Follow our contribution guide to learn how you can add support for more languages.
3535

36-
## Creating Language Class
36+
## Creating a Language Class
3737

3838
First, create a new class for the new language in this directory:
3939
[/src/SDK/Language](https://github.com/appwrite/sdk-generator/tree/master/src/SDK/Language)
@@ -43,22 +43,22 @@ You can use the interface to know which methods are required to be implemented:
4343
[/src/SDK/Language.php](https://github.com/appwrite/sdk-generator/blob/master/src/SDK/Language.php)
4444

4545
**getName**
46-
SDK Language name (JS, PHP…)
46+
Name of SDK language, such as JS, PHP, C++, etc.
4747

4848
**getKeywords**
49-
An array with language keywords to avoid using as param or function names, template engine will solve conflicts
49+
An array with language keywords to avoid using as param or function names, template engine will solve conflicts.
5050

5151
**getIdentifierOverrides**
52-
Returns an associative array that can be used to override keywords with pre-defined word using `overrideIdentifier` filter.
52+
Returns an associative array that can be used to override keywords with a pre-defined word using `overrideIdentifier` filter.
5353

5454
**getFiles**
5555
An array with a list of language template files in [twig format](https://twig.symfony.com/).
5656
Each file scope determines what template parameters will be available.
5757

58-
* Default scope - Basic SDK and language-specific params (package name, language name, etc…)
59-
* Service scope - Generate x templates where x is the number of API services, adds service-specific params to the template (service name, methods, etc…)
60-
* Method scope - Generate x*y templates where x is the number of API services and y is the number of methods, adds service and method-specific params to the template (service name, method name, method params, etc…), good for generating MD files with examples for using each method
61-
* Copy scope - Static files (like images, etc…) that will just get copied and not processed by twig.
58+
* Default scope - Basic SDK and language-specific params such as package name and language name.
59+
* Service scope - Generate x templates where x is the number of API services, adds service-specific params to the template such as service name and methods.
60+
* Method scope - Generate x*y templates where x is the number of API services and y is the number of methods, adds service and method-specific params to the template, such as service name, method name, and method params. Used to generate MD files with examples for documenting each method.
61+
* Copy scope - Static files such as images that will be copied directly and not processed by twig.
6262

6363
**getTypeName**
6464
This method receives the API param type and should return the equivalent param in the implemented language.
@@ -67,19 +67,19 @@ This method receives the API param type and should return the equivalent param i
6767
This method receives the API param and should return the equivalent default value of param in the implemented language, for example, a default array param in PHP is represented as [].
6868

6969
**getParamExample**
70-
This method receives the API param and should return the equivalent example value of param in the implemented language, for example, if an example value is **some text** in PHP return value should be **'some text'** (with quotes).
70+
This method receives the API param and should return the equivalent example value of param in the implemented language. For example, if an example value is **some text** in PHP, the return value should be **'some text'** (with quotes).
7171

72-
Notice: The easiest way to get started is to copy an existing language class close to the new language about to be implemented and just edit it.
72+
Note: The easiest way to get started is to copy an existing language class close to the new language about to be implemented and just edit it.
7373

7474
## Adding Templates
7575

7676
Add your new templates as listed in your language class **getFiles** method. Make sure to follow the [checklist](#sdk-checklist) when building the language templates.
7777

78-
Make sure to follow the objects structure and service separation architecture. We aim to keep developer experience as consisted as possible across different SDKs to make the learning curve as small as possible.
78+
Make sure to follow the object's structure and service separation architecture. We aim to keep Appwrite's developer experience as consistent as possible across different SDKs to make the learning curve as flat as possible.
7979

80-
> Appwrite SDK generator adds some filters to the TWIG templates to allow common code formatting options like converting text to camelCase, dash-case and other. Full list is available in the [SDK class](https://github.com/appwrite/sdk-generator/blob/master/src/SDK/SDK.php#L62)
80+
> The Appwrite SDK generator adds some filters to the twig templates to allow common code formatting options like converting text to camelCase, snake_case and others. The full list is available in the [SDK class](https://github.com/appwrite/sdk-generator/blob/master/src/SDK/SDK.php#L62)
8181
82-
When in need to test the API templates output, add your new language instance to the `example.php` file like this:
82+
When you need to test the API templates output, add your new language instance to the `example.php` file like this:
8383

8484
sdk-generator/blob/master/example.php:
8585

@@ -118,16 +118,16 @@ Run the following command (make sure you have an updated docker version on your
118118
docker run --rm -v $(pwd):/app -w /app php:7.4-cli php example.php
119119
```
120120

121-
>Note: You can just add the new language next to the other languages in example.php file, no need to rewrite the file completely.
121+
>Note: You can just add the new language next to the other languages in the `example.php` file. You don't need to rewrite the file completely.
122122
123-
Check your output files at: /examples/new-lang and make sure the SDK works. When possible add some unit tests.
123+
Check your output files at: /examples/new-lang and make sure the SDK works. When possible, add some unit tests.
124124

125125
## SDK Checklist
126126

127-
It is very important for us to create consistent structure, architecture and native like feel for the SDKs we generate.
128-
In order to accomplish that we have made a checklist of points to support while adding a new language to the SDK generator.
127+
It is very important for us to create a consistent structure and architecture, as well as a language-native feel for the SDKs we generate.
128+
To accomplish this, we have made a checklist of points to support while adding a new language to the SDK generator.
129129

130-
The following checklist aims to balance consistency among languages, and follow each platform's best practices and coding standards.
130+
The following checklist aims to balance consistency among languages and follow each platform's best practices and coding standards.
131131

132132
- [ ] Proper Coding Standards and Conventions
133133
- [ ] Proper Skeleton Structure
@@ -142,8 +142,8 @@ The following checklist aims to balance consistency among languages, and follow
142142
- [ ] Default Headers
143143
- [ ] 'appwrite-sdk-version' header
144144
- [ ] Add 'User-Agent' header with device/server name and version + platform name and version (ubuntu-20.04-php-7.0.1 / android-20.0-flutter-3.0)
145-
- [ ] Add 'origin' header with the following syntax `<scheme>://<identifier>` where scheme is one of `http`, `https`, `appwrite-android`, `appwrite-ios`, `appwrite-macos`, `appwrite-windows`, `appwrite-linux` and identifier is the host name is case of web apps and the package name in case of ios, android and other platforms.
146-
- [ ] All Global headers available in spec
145+
- [ ] Add 'origin' header with the following syntax `<scheme>://<identifier>` where scheme is one of `http`, `https`, `appwrite-android`, `appwrite-ios`, `appwrite-macos`, `appwrite-windows`, `appwrite-linux`. The identifier is host name for web apps and package name for iOS, Android and other platforms.
146+
- [ ] All global headers in the spec
147147
- [ ] Methods
148148
- [ ] addHeader(key, value)
149149
- [ ] call(method, path = '', headers = [], params = [])
@@ -169,7 +169,7 @@ The following checklist aims to balance consistency among languages, and follow
169169

170170
## Tests
171171

172-
Testing a single project that runs in multiple languages can be very hard. Managing dependencies with multiple package managers of different ecosystems can take the SDK Generator complexity to extreme levels.
172+
Testing a single project that runs in multiple languages can be difficult. Managing dependencies with multiple package managers of different ecosystems can take the SDK Generator complexity to extreme levels.
173173

174174
To avoid that complexity, we have created a cross-platform mechanism that leverages Docker and a vanilla language file with no dependencies attached.
175175

@@ -183,14 +183,14 @@ To get started, create a language file in this ___location:
183183

184184
In your new language file, init your SDK from a relative path which will be generated here: `./tests/sdks/` from this spec file: `./tests/resources/spec.json`.
185185

186-
After you finish initializing, make a series of HTTP calls using your new generated SDKs method just like in one of these examples:
186+
After you finish initializing, make a series of HTTP calls using your newly generated SDKs method just like in one of these examples:
187187

188188
1. tests/languages/php/test.php
189189
2. tests/languages/node/test.js
190190

191191
> Note: In your test files, make sure that you begin the test with the following string "\nTest Started\n". We use this string to filter output from the build tool you're using.
192192
193-
Once done, create a new test file `tests/[Language]Test.php` and update as the following.
193+
Once you're done, create a new test file `tests/[Language]Test.php` and update as the following.
194194

195195
```php
196196
<?php
@@ -206,7 +206,7 @@ class [Language]Test extends Base
206206
];
207207
protected array $envs = [
208208
// docker commands that can execute test file to the sdk test. Make sure to add
209-
// one command for each lanuage version you wish to support
209+
// one command for each language version you wish to support
210210
];
211211

212212
// list of expected outputs from test based on features supported
@@ -248,39 +248,39 @@ class DartTest extends Base
248248
}
249249
```
250250

251-
Also in `.travis.yml` add new env `SDK=[Language]` so that travis will run test for this language as well.
251+
Also in `.travis.yml` add new env `SDK=[Language]` so that travis will run a test for this language as well.
252252

253-
Finally, you can run tests using
253+
Finally, you can run tests using:
254254
```sh
255255
docker run --rm -v $(pwd):$(pwd):rw -w $(pwd) -v /var/run/docker.sock:/var/run/docker.sock php:7.4-cli-alpine sh -c "apk add docker-cli && vendor/bin/phpunit"
256256
```
257257

258258
## SDK Generator Interface
259259

260-
* **spec** -- This object is derived from the appwrite swagger spec
260+
* **spec** -- This object is derived from the Appwrite swagger spec
261261
* **title** -> The title of the SDK you are generating (normally used as package name.)
262262
* **description** -> Description of Appwrite SDK
263263
* **namespace** -> SDK Namespace
264264
* **version** -> SDK Version
265265
* **endpoint** -> Default Endpoint (example: "https://appwrite.io/v1")
266266
* **host** -> Default Host (example: "appwrite.io")
267267
* **basePath** -> Default Path to API (example: "/v1")
268-
* **licenseName** -> Name of licence for SDK
269-
* **licenseURL** -> URL to SDK Licence
268+
* **licenseName** -> Name of license for SDK
269+
* **licenseURL** -> URL to SDK license
270270
* **contactName** -> Name of Person/Team that created the SDK
271271
* **contactURL** -> URL to contact for help with the SDK
272272
* **contactEmail** -> Email Address to Contact for help with the SDK
273273
* **services** -> Array of Services. Each service contains the following:
274274
* **name** -> The name of the service
275-
* **methods** -> Array of Methods that can be used with the service
275+
* **methods** -> Array of methods that can be used with the service
276276
* **method** -> HTTP Method to call
277277
* **path** -> Path to API without a basePath
278278
* **fullPath** -> Path to API with basePath
279279
* **name** -> Name of API Method
280280
* **packaging** -> A flag to indicate if the files at a path need to be packaged as a tar file
281281
* **title** -> Title of API Method
282282
* **description** -> Description of API Method
283-
* **security** -> Array of security methods for this API Call. Primarily used for code examples.
283+
* **security** -> Array of security methods for this API call. Primarily used for code examples.
284284
* **consumes** -> Array of Content-Type headers the API Route accepts.
285285
* **cookies** -> Are cookies required? Bool
286286
* **type** -> Response Type. Tells us whether the endpoint returns a JSON Payload, A URL or redirect to an auth mechanism.
@@ -290,9 +290,9 @@ docker run --rm -v $(pwd):$(pwd):rw -w $(pwd) -v /var/run/docker.sock:/var/run/d
290290
* **headers** -> Array containing parameters that go in the header
291291
* **path** -> Array containing parameters that go into the path of the API URL
292292
* **query** -> Array containing parameters that go into the query of the API URL
293-
* **body** -> Array containing parameters that go in the body
293+
* **body** -> Array containing parameters that go into the body
294294

295-
All Parameters will have a structure like so:
295+
All Parameters will have a structure like this:
296296
* **name** -> Name of parameter
297297
* **type** -> Parameter Type
298298
* **description** -> Parameter Description
@@ -302,14 +302,14 @@ docker run --rm -v $(pwd):$(pwd):rw -w $(pwd) -v /var/run/docker.sock:/var/run/d
302302
* **array**
303303
* **type** -> Array Type (only used if param type is "array")
304304
* **global**
305-
* **headers** -> A object containing all global headers
306-
* **defaultHeaders** -> A object containing all default headers
305+
* **headers** -> An object containing all global headers
306+
* **defaultHeaders** -> An object containing all default headers
307307

308308
* **language** -- Information on the current language SDK
309309
* **name** -> Name of language
310-
* **params** -> Custom language specific parameters
310+
* **params** -> Custom language-specific parameters
311311

312-
* **sdk** -- Various Metadata used for packaging and categorising
312+
* **sdk** -- Various Metadata used for packaging and categorizing
313313
* **namespace** -> SDK Namespace
314314
* **name** -> SDK Name
315315
* **description** -> SDK Desc
@@ -327,10 +327,10 @@ docker run --rm -v $(pwd):$(pwd):rw -w $(pwd) -v /var/run/docker.sock:/var/run/d
327327
* **shareURL** -> Social Media Metadata
328328
* **shareVia** -> Social Media Metadata
329329
* **shareTags** -> Social Media Metadata
330-
* **warning** -> Used for warnings usually communicated within the Readme.md
331-
* **gettingStarted** -> Raw Markdown for Getting Started
332-
* **readme** -> Stores the raw markdown used to generate the readme.md file. [here](https://github.com/appwrite/sdk-for-flutter/blob/master/README.md)
333-
* **changelog** -> Stores the raw markdown used to generate the changelog.md file. [here](https://github.com/appwrite/sdk-for-flutter/blob/master/CHANGELOG.md)
330+
* **warning** -> Used for warnings usually communicated within the `README.md`
331+
* **gettingStarted** -> Raw markdown for getting started
332+
* **readme** -> Stores the raw markdown used to generate the `README.md` file. [here](https://github.com/appwrite/sdk-for-flutter/blob/master/README.md)
333+
* **changelog** -> Stores the raw markdown used to generate the `changelog.md` file. [here](https://github.com/appwrite/sdk-for-flutter/blob/master/CHANGELOG.md)
334334
* **examples** -> Stores the raw markdown used to generate examples for your SDK. An example can be found [here](https://github.com/appwrite/sdk-for-flutter/tree/master/example)
335335
* **twitterHandle** -> Twitter handle of creator
336336
* **discordChannel** -> Discord Channel ID for SDK

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
**WORK IN PROGRESS - NOT READY FOR GENERAL USAGE**
1010

11-
[Appwrite](https://appwrite.io) SDK generator is a PHP library for auto generating SDK libraries for multiple languages and platforms.
11+
[Appwrite](https://appwrite.io) SDK generator is a PHP library for auto-generating SDK libraries for multiple languages and platforms.
1212

1313
The SDK Generator uses predefined language settings as [Twig templates](https://twig.symfony.com/) to generate codebases based on different API specs.
1414

15-
Currently, the only spec supported is Swagger 2.0, but we intend to add support for more specifications in the near future. This generator is still lacking support for any definition/models specs.
15+
Currently, the only spec supported is Swagger 2.0, but we intend to add support for more specifications in the near future. This generator is still lacking support for any definition/model specs.
1616

1717
## Getting Started
1818

@@ -134,7 +134,7 @@ $sdk->generate(__DIR__ . '/examples/php'); // Generate source code
134134

135135
## Contributing
136136

137-
All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.
137+
All code contributions, including those by people with commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure proper review of all the code.
138138

139139
We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the [contribution guide](CONTRIBUTING.md).
140140

0 commit comments

Comments
 (0)