mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 15:40:26 +01:00
3.1 KiB
3.1 KiB
Twitter OpenAPI
Twitter OpenAPI(Swagger) specification
Usage
openapi-generator-cli generate -g <language> -i https://raw.githubusercontent.com/fa0311/twitter-openapi/main/dist/typescript/openapi-3.0.yaml -o ./generated
If the language supports variable-length arguments.
openapi-generator-cli generate -g <language> -i https://raw.githubusercontent.com/fa0311/twitter-openapi/main/dist/dart/openapi-3.0.yaml -o ./generated
Note that the license also inherits to the output.
Contribute
src*.yaml files should be written according to the v3.0/schema.jsondistDo not rewrite this file as it is an automatically generated OpenAPI file.
About build
src/openapi/**/*.yaml#/paths/*/*/parameterswill be overwritten bysrc/config/parameters.yaml#/paths/~1parameters/*/parameters- This overwritten done before parsing yaml
src/openapi/**/*.yaml#/paths/*/*/requestBodywill be overwritten bysrc/config/parameters.yaml#/paths/~1parameters/*/requestBody- This overwritten done before parsing yaml
src/openapi/**/*.yaml#/paths/*/get/responses/200/headerswill be overwritten bysrc/config/headers.yaml#/components/headers- This overwritten done before parsing yaml
- Items enclosed in double brackets are placeholders
src/config/placeholder.jsonreplaces it- If a placeholder is used in
src/config/**/*.yaml, the pathname is added as a prefix - This substitution is done before parsing the yaml
variable.json
It can be written as {% if variable == value %} { endif }
| lang | description |
|---|---|
| docs | Outputs the most correct swagger syntax |
| typescript | Since it is difficult to handle default values with the typescript generator, we refer to src/config/placeholder.json and handle default values |
| dart | Basically the same as typescript, but headers are processed as parameters |
*_parameters = string
- This is defined in
src/config/parameters.yaml - Replace
src/config/placeholder.jsonas an string
*_parameters = object
- This is defined in
src/config/parameters.yaml - Replace
src/config/placeholder.jsonas an object
*_parameters = schema_content
- The schema automatically generated from the
src/config/placeholder.jsonis replaced withsrc/openapi/**/*.yaml#/paths/*/*/parameters - Some generators cannot handle it correctly because it generates the syntax introduced in swagger 3.0
- This is defined in
tools/build.py
*_parameters = schema_parameters
- The schema automatically generated from the
src/config/placeholder.jsonis replaced withsrc/openapi/**/*.yaml#/paths/*/*/parameters
*_parameters = schema_request_body
- The schema automatically generated from the
src/config/placeholder.jsonis replaced withsrc/openapi/**/*.yaml#/paths/*/*/requestBody
command
python -V # Python 3.10.8
pip install -r requirements.txt
python tools/build.py