Skip to content

Commit

Permalink
Move to docusaurus
Browse files Browse the repository at this point in the history
Signed-off-by: arekkas <[email protected]>
  • Loading branch information
arekkas committed Nov 15, 2018
1 parent 07816ff commit d04fdce
Show file tree
Hide file tree
Showing 423 changed files with 93,822 additions and 501 deletions.
76 changes: 15 additions & 61 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,82 +5,36 @@ version: 2
jobs:
publish:
docker:
- image: circleci/node:9-browsers
- image: circleci/node:11.1
working_directory: /home/circleci/docs
environment:
- GITBOOK_DIR: /home/circleci/docs/.gitbook
- VERSION: latest
steps:
- checkout
- run: >
if [ -z ${CIRCLE_TAG+x} ]; then echo "Skipping tagging because not a tag"; else find ./guides/ -name "*.md" -type f -print0 | xargs -0 sed -i 's/'$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))'/'${CIRCLE_TAG}'/g'; fi
- run: yarn install
- run: yarn build
- run: git config --global user.email "[email protected]"
- run: cd website; npm ci
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ORY Continuous Integration"
- run: "git clone https://arekkas:[email protected]/ory/ory-am.git ../ory-am"
- run: cd website; npm run api
- run: cd website; npm build
- run: rm -rf ../ory-am/docs/
- run: cp -R ./website/build/docs/* ../ory-am/docs/

- run: "VERSION=${CIRCLE_TAG:-master}; mkdir -p ../ory-am/docs/guides/$VERSION/ || exit 0"
- run: "VERSION=${CIRCLE_TAG:-master}; mkdir -p ../ory-am/docs/apis/$VERSION/ || exit 0"

- run: "VERSION=${CIRCLE_TAG:-master}; rm -rf ../ory-am/docs/guides/$VERSION/* || exit 0"
- run: "VERSION=${CIRCLE_TAG:-master}; rm -rf ../ory-am/docs/apis/$VERSION/* || exit 0"

- run: "cp -R ./build/faq/* ../ory-am/docs/faq/"

- run: "VERSION=${CIRCLE_TAG:-master}; cp -R ./build/guides/* ../ory-am/docs/guides/$VERSION/"
- run: "VERSION=${CIRCLE_TAG:-master}; cp -R ./apis/* ../ory-am/docs/apis/$VERSION/"

- run: 'if [ -z ${CIRCLE_TAG+x} ]; then echo "Skipping push to guides latest"; else (rm -rf ../ory-am/docs/guides/latest; mkdir -p ../ory-am/docs/guides/latest; cp -R ./build/guides/* ../ory-am/docs/guides/latest); fi'
- run: 'if [ -z ${CIRCLE_TAG+x} ]; then echo "Skipping push to apis latest"; else (rm -rf ../ory-am/docs/apis/latest; mkdir -p ../ory-am/docs/apis/latest; cp -R ./apis/* ../ory-am/docs/apis/latest); fi'

- run: "VERSION=${CIRCLE_TAG:-master}; cp -R ./build/guides/* ../ory-am/docs/guides/$VERSION/"
- run: "VERSION=${CIRCLE_TAG:-master}; cp -R ./apis/* ../ory-am/docs/apis/$VERSION/"

- run: "(VERSION=${CIRCLE_TAG:-master}; cd ../ory-am && git add -A && git commit -a -m \"docs: Updates documentation version $VERSION\" && git push origin) || exit 0"

tag:
test:
docker:
- image: circleci/node:9-browsers
- image: circleci/node:11.1
working_directory: /home/circleci/docs
steps:
- checkout
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "ORY Continuous Integration"
- run:
shell: /bin/bash
command: ./.circleci/tag.sh
- run: cat ./guides/book.json
- run: cat ./guides/package.json
- run: >
find ./guides/ -name "*.md" -type f -print0 | xargs -0 sed -i 's/'$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))'/'${CIRCLE_TAG}'/g'
- run: "git commit -a -m \"Updates guides to version ${CIRCLE_TAG}\""
- run: git remote rm origin
- run: git remote add origin https://arekkas:[email protected]/ory/docs.git
- run: git push origin HEAD:master
- run: cd website; npm ci
- run: ./scripts/test-links.sh

workflows:
version: 2
"publish-master":
jobs:
- publish:
filters:
branches:
only: master
"publish-tag":
publish:
jobs:
- test
- publish:
filters:
branches:
ignore: /.*/
tags:
only: /.*/
- tag:
# This avoids race conditions (as both publish-tag and publish-master push to the website):
requires:
- publish
- test
filters:
branches:
ignore: /.*/
tags:
only: /.*/
only: master
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/node_modules
*.log
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -crlf
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
node_modules/
build/
_book/
.DS_Store

node_modules

lib/core/metadata.js
lib/core/MetadataBlog.js

website/translated_docs
website/build/
website/yarn.lock
website/node_modules
website/i18n/*
24 changes: 24 additions & 0 deletions .widdershins/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"language_tabs": [],
"verbose": true,
"codeSamples": true,
"httpSnippet": true,
"search": false,
"discovery": false,
"tocSummary": true,
"sample": true,
"tagGroups": [
{
"title": "Public Endpoints",
"tags": [
"public"
]
},
{
"title": "Administrative Endpoints",
"tags": [
"admin"
]
}
]
}
63 changes: 63 additions & 0 deletions .widdershins/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## 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)
5 changes: 5 additions & 0 deletions .widdershins/templates/authentication.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<aside class="warning">
To perform this operation, you must be authenticated by means of one of the following methods:
{{= data.utils.getAuthenticationStr(data) }}
</aside>

3 changes: 3 additions & 0 deletions .widdershins/templates/authentication_none.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<aside class="success">
This operation does not require authentication
</aside>
38 changes: 38 additions & 0 deletions .widdershins/templates/callbacks.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{? data.operation.callbacks}}

#### Callbacks

<div class="content well">

{{ data.oldOperation = data.operation; }}

{{ for (var c in data.operation.callbacks) { }}

##### {{=c}}

{{ var callback = data.operation.callbacks[c]; }}

{{ for (var e in callback) { }}

**{{=e}}**

{{ var exp = callback[e]; }}

{{ for (var m in exp) { }}

{{ data.operation = exp[m]; }}
{{ data.method.operation = data.operation; }}

{{= data.templates.operation(data) }}

{{ } /* of methods */ }}

{{ } /* of expressions */ }}

{{ } /* of callbacks */ }}

{{ data.operation = data.oldOperation; }}

</div>

{{?}}
23 changes: 23 additions & 0 deletions .widdershins/templates/code_go.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"bytes"
"net/http"
)

func main() {

{{?data.allHeaders.length}}
headers := map[string][]string{
{{~data.allHeaders :p:index}}"{{=p.name}}": []string{"{{=p.exampleValues.object}}"},
{{~}}
}{{?}}

data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("{{=data.methodUpper}}", "{{=data.url}}", data)
req.Header = headers

client := &http.Client{}
resp, err := client.Do(req)
// ...
}
7 changes: 7 additions & 0 deletions .widdershins/templates/code_http.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{=data.methodUpper}} {{=data.url}}{{=data.requiredQueryString}} HTTP/1.1{{? data.host}}
Host: {{=data.host}}{{?}}{{?data.consumes.length}}
Content-Type: {{=data.consumes[0]}}{{?}}{{?data.produces.length}}
Accept: {{=data.produces[0]}}{{?}}
{{?data.headerParameters.length}}{{~ data.headerParameters :p:index}}{{=p.name}}: {{=p.exampleValues.object}}
{{~}}
{{?}}
13 changes: 13 additions & 0 deletions .widdershins/templates/code_java.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
URL obj = new URL("{{=data.url}}{{=data.requiredQueryString}}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("{{=data.methodUpper}}");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
14 changes: 14 additions & 0 deletions .widdershins/templates/code_javascript.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{?data.allHeaders.length}}var headers = {
{{~data.allHeaders :p:index}} '{{=p.name}}':{{=p.exampleValues.json}}{{?index < data.allHeaders.length-1}},{{?}}
{{~}}
};
{{?}}
$.ajax({
url: '{{=data.url}}',
method: '{{=data.method.verb}}',
{{?data.requiredQueryString}} data: '{{=data.requiredQueryString}}',{{?}}
{{?data.allHeaders.length}} headers: headers,{{?}}
success: function(data) {
console.log(JSON.stringify(data));
}
})
18 changes: 18 additions & 0 deletions .widdershins/templates/code_nodejs.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const fetch = require('node-fetch');
{{?data.bodyParameter.present}}const inputBody = '{{=data.bodyParameter.exampleValues.json}}';{{?}}
{{?data.allHeaders.length}}const headers = {
{{~data.allHeaders :p:index}} '{{=p.name}}':{{=p.exampleValues.json}}{{?index < data.allHeaders.length-1}},{{?}}
{{~}}
};
{{?}}
fetch('{{=data.url}}{{=data.requiredQueryString}}',
{
method: '{{=data.methodUpper}}'{{?data.bodyParameter.present || data.allHeaders.length}},{{?}}
{{?data.bodyParameter.present}} body: inputBody{{?}}{{? data.bodyParameter.present && data.allHeaders.length}},{{?}}
{{?data.allHeaders.length}} headers: headers{{?}}
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
10 changes: 10 additions & 0 deletions .widdershins/templates/code_python.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import requests
{{?data.allHeaders.length}}headers = {
{{~data.allHeaders :p:index}} '{{=p.name}}': {{=p.exampleValues.json}}{{?index < data.allHeaders.length-1}},{{?}}
{{~}}}
{{?}}
r = requests.{{=data.method.verb}}('{{=data.url}}', params={
{{~ data.requiredParameters :p:index}} '{{=p.name}}': {{=p.exampleValues.json}}{{? data.requiredParameters.length-1 != index }},{{?}}{{~}}
{{?data.allHeaders.length}}}, headers = headers{{?}})

print r.json()
14 changes: 14 additions & 0 deletions .widdershins/templates/code_ruby.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rest-client'
require 'json'

{{?data.allHeaders.length}}headers = {
{{~data.allHeaders :p:index}} '{{=p.name}}' => {{=p.exampleValues.json}}{{?index < data.allHeaders.length-1}},{{?}}
{{~}}}{{?}}

result = RestClient.{{=data.method.verb}} '{{=data.url}}',
params: {
{{~ data.requiredParameters :p:index}}'{{=p.name}}' => '{{=p.safeType}}'{{? data.requiredParameters.length-1 != index }},{{?}}
{{~}}}{{? data.allHeaders.length}}, headers: headers
{{?}}

p JSON.parse(result)
3 changes: 3 additions & 0 deletions .widdershins/templates/code_shell.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curl -X {{=data.methodUpper}} {{=data.url}}{{=data.requiredQueryString}}{{?data.allHeaders.length}} \{{?}}
{{~data.allHeaders :p:index}} -H '{{=p.name}}: {{=p.exampleValues.object}}'{{?index < data.allHeaders.length-1}} \{{?}}
{{~}}
1 change: 1 addition & 0 deletions .widdershins/templates/debug.def
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{= data.utils.inspect(data) }}
11 changes: 11 additions & 0 deletions .widdershins/templates/discovery.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "WebAPI",
{{? data.api.info.description }}"description": "{{=data.api.info.description}}",{{?}}
{{? data.api.externalDocs }}"documentation": "{{=data.api.externalDocs.url}}",{{?}}
{{? data.api.info.termsOfService }}"termsOfService": "{{=data.api.info.termsOfService}}",{{?}}
{{? data.api.info["x-logo"] && data.api.info["x-logo"].url }}"logo": "{{=data.api.info["x-logo"].url}}",{{?}}
"name": "{{=data.api.info.title}}"
}
</script>
2 changes: 2 additions & 0 deletions .widdershins/templates/footer.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


Loading

0 comments on commit d04fdce

Please sign in to comment.