mirror of
https://github.com/coder/coder.git
synced 2025-07-23 21:32:07 +00:00
chore: Improve project-wide prettier formatting and ignored files (#5505)
* chore: Improve project-wide prettier formatting and ignored files * chore: `Run make fmt/prettier` * Fix gitignore for `.vscode` folder so that ! works * Add comment in `.prettierrc.yaml` to explain `.editorconfig` * Remove scripts/apidocgen/markdown-template/README.md * Use `yq` for processing prettierrc, update lib.sh dependency check * Add `yq` to Dockerfile and Nix
This commit is contained in:
committed by
GitHub
parent
5435bceaf0
commit
856f0ab6f5
@ -1,64 +0,0 @@
|
||||
## Swagger / OpenAPI 2 and OpenAPI 3 template parameters
|
||||
|
||||
Note that properties of OpenAPI objects will be in OpenAPI 3.0 form, as
|
||||
Swagger / OpenAPI 2.0 definitions are converted automatically.
|
||||
|
||||
### Code templates
|
||||
|
||||
* `method` - the HTTP method of the operation (in lower-case)
|
||||
* `methodUpper` - the HTTP method of the operation (in upper-case)
|
||||
* `url` - the full URL of the operation (including protocol and host)
|
||||
* `consumes[]` - an array of MIME-types the operation consumes
|
||||
* `produces[]` - an array of MIME-types the operation produces
|
||||
* `operation` - the current operation object
|
||||
* `operationId` - the current operation id
|
||||
* `opName` - the operationId if set, otherwise the method + path
|
||||
* `tags[]` - the full list of tags applying to the operation
|
||||
* `security` - the security definitions applying to the operation
|
||||
* `resource` - the current tag/path object
|
||||
* `parameters[]` - an array of parameters for the operation (see below)
|
||||
* `queryString` - an example queryString, urlEncoded
|
||||
* `requiredQueryString` - an example queryString for `required:true` parameters
|
||||
* `queryParameters[]` - a subset of `parameters` that are `in:query`
|
||||
* `requiredParameters[]` - a subset of `queryParameters` that are `required:true`
|
||||
* `headerParameters[]` - a subset of `parameters` that are `in:header`
|
||||
* `allHeaders[]` - a concatenation of `headerParameters` and pseudo-parameters `Accept` and `Content-Type`, and optionally `Authorization` (the latter has an `isAuth` boolean property set true so it can be omitted in templates if desired
|
||||
|
||||
### Parameter template
|
||||
|
||||
* `parameters[]` - an array of [parameters](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject), including the following pseudo-properties
|
||||
* `shortDesc` - a truncated version of the parameter description
|
||||
* `safeType` - a computed version of the parameter type, including Body and schema names
|
||||
* `originalType` - the original type of the parameter
|
||||
* `exampleValues` - an object containing examples for use in code-templates
|
||||
* `json` - example values in JSON compatible syntax
|
||||
* `object` - example values in raw object form (unquoted strings etc)
|
||||
* `depth` - a zero-based indicator of the depth of expanded request body parameters
|
||||
* `enums[]` - an array of (parameter)name/value pairs
|
||||
|
||||
### Responses template
|
||||
|
||||
* `responses[]` - an array of [responses](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject), including `status` and `meaning` properties
|
||||
|
||||
### Authentication template
|
||||
|
||||
* `authenticationStr` - a simple string of methods (and scopes where appropriate)
|
||||
* `securityDefinitions[]` - an array of applicable [securityDefinitions](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securityRequirementObject)
|
||||
|
||||
### Schema Property template
|
||||
|
||||
* `schemaProperties[]` - an array of
|
||||
* `name`
|
||||
* `type`
|
||||
* `required`
|
||||
* `description`
|
||||
* `enums[]` - an array of (schema property)name/value pairs
|
||||
|
||||
### Common to all templates
|
||||
|
||||
* `openapi` - the top-level OpenAPI / Swagger document
|
||||
* `header` - the front-matter of the Slate/Shins markdown document
|
||||
* `host` - the (computed) host of the API
|
||||
* `protocol` - the default/first protocol of the API
|
||||
* `baseUrl` - the (computed) baseUrl of the API (including protocol and host)
|
||||
* `widdershins` - the contents of widdershins `package.json`
|
@ -13,7 +13,6 @@ This main.go generates typescript types from the codersdk types in Go.
|
||||
- [ ] External Types (uses `any` atm)
|
||||
- Some custom external types are hardcoded in (eg: time.Time)
|
||||
|
||||
|
||||
## Type overrides
|
||||
|
||||
```golang
|
||||
|
@ -75,10 +75,22 @@ execrelative() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
dependency_check() {
|
||||
local dep=$1
|
||||
|
||||
# Special case for yq that can be yq or yq4.
|
||||
if [[ $dep == yq ]]; then
|
||||
[[ -n "${CODER_LIBSH_YQ:-}" ]]
|
||||
return
|
||||
fi
|
||||
|
||||
command -v "$dep" >/dev/null
|
||||
}
|
||||
|
||||
dependencies() {
|
||||
local fail=0
|
||||
for dep in "$@"; do
|
||||
if ! command -v "$dep" >/dev/null; then
|
||||
if ! dependency_check "$dep"; then
|
||||
log "ERROR: The '$dep' dependency is required, but is not available."
|
||||
fail=1
|
||||
fi
|
||||
@ -200,9 +212,25 @@ if [[ "${CODER_LIBSH_NO_CHECK_DEPENDENCIES:-}" != *t* ]]; then
|
||||
log
|
||||
fi
|
||||
|
||||
# Allow for yq to be installed as yq4.
|
||||
if command -v yq4 >/dev/null; then
|
||||
export CODER_LIBSH_YQ=yq4
|
||||
elif command -v yq >/dev/null; then
|
||||
if [[ $(yq --version) == *" v4."* ]]; then
|
||||
export CODER_LIBSH_YQ=yq
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$libsh_bad_dependencies" == 1 ]]; then
|
||||
error "Invalid dependencies, see above for more details."
|
||||
fi
|
||||
|
||||
export CODER_LIBSH_NO_CHECK_DEPENDENCIES=true
|
||||
fi
|
||||
|
||||
# Alias yq to the version we want by shadowing with a function.
|
||||
if [[ -n ${CODER_LIBSH_YQ:-} ]]; then
|
||||
yq() {
|
||||
command $CODER_LIBSH_YQ "$@"
|
||||
}
|
||||
fi
|
||||
|
@ -11,7 +11,6 @@ maintainer: Coder <support@coder.com>
|
||||
description: |
|
||||
Provision development environments with infrastructure with code
|
||||
license: AGPL-3.0
|
||||
|
||||
suggests:
|
||||
- postgresql
|
||||
|
||||
|
Reference in New Issue
Block a user