-
-
Notifications
You must be signed in to change notification settings - Fork 5
Support collection-level markdown documentation #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jviotti
wants to merge
2
commits into
main
Choose a base branch
from
markdown-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM one | ||
| COPY one.json . | ||
| COPY schemas schemas | ||
| COPY docs docs | ||
| RUN sourcemeta one.json --profile | ||
| RUN set -e && test -d "$SOURCEMETA_ONE_WORKDIR" && \ | ||
| test -z "$(ls -A "$SOURCEMETA_ONE_WORKDIR")" | ||
| RUN rm -rf "$SOURCEMETA_ONE_WORKDIR" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| include ../../../test/e2e/common.mk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| services: | ||
| sandbox: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| args: | ||
| SOURCEMETA_ONE_SANDBOX_EDITION: ${EDITION} | ||
| environment: | ||
| - SOURCEMETA_ONE_PORT=8001 | ||
| ports: | ||
| - "${PORT}:8001" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Headless Documentation | ||
|
|
||
| Documentation for the **test** collection in headless mode. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| # Collection with documentation has the documentation URL in the full list response | ||
| GET {{base}}/self/v1/api/list/test | ||
| HTTP 200 | ||
| Content-Type: application/json | ||
| Access-Control-Allow-Origin: * | ||
| Link: </self/v1/schemas/api/list/response>; rel="describedby" | ||
| [Captures] | ||
| last_response: body | ||
| schema_path: header "Link" regex "<([^>]+)>" | ||
| documentation_url: jsonpath "$.documentation" | ||
| [Asserts] | ||
| header "ETag" exists | ||
| header "Last-Modified" exists | ||
| jsonpath "$.path" == "/test" | ||
| jsonpath "$.url" == "{{base}}/test" | ||
| jsonpath "$.schemas" == 1 | ||
| jsonpath "$.health" == 0 | ||
| jsonpath "$.breadcrumb" count == 1 | ||
| jsonpath "$.breadcrumb[0].name" == "test" | ||
| jsonpath "$.breadcrumb[0].path" == "/test/" | ||
| jsonpath "$.documentation" matches "^/self/v1/static/[a-f0-9]{64}$" | ||
|
jviotti marked this conversation as resolved.
|
||
| jsonpath "$.entries" count == 1 | ||
| jsonpath "$.entries[0].name" == "string" | ||
| jsonpath "$.entries[0].type" == "schema" | ||
| jsonpath "$.entries[0].path" == "/test/string" | ||
| jsonpath "$.entries[0].identifier" == "{{base}}/test/string" | ||
| jsonpath "$.entries[0].bytes" == 129 | ||
| jsonpath "$.entries[0].baseDialect" == "https://json-schema.org/draft/2020-12/schema" | ||
| jsonpath "$.entries[0].dialect" == "https://json-schema.org/draft/2020-12/schema" | ||
| jsonpath "$.entries[0].health" == 0 | ||
| jsonpath "$.entries[0].dependencies" == 0 | ||
| jsonpath "$.entries[0].alert" == null | ||
| jsonpath "$.entries[0].provenance" == null | ||
| jsonpath "$.entries[0].documentation" not exists | ||
|
|
||
| POST {{base}}/self/v1/api/schemas/evaluate{{schema_path}} | ||
| ``` | ||
| {{last_response}} | ||
| ``` | ||
| HTTP 200 | ||
| Link: </self/v1/schemas/api/schemas/evaluate/response>; rel="describedby" | ||
| [Asserts] | ||
| jsonpath "$.valid" == true | ||
|
|
||
| # The static file endpoint serves the raw markdown content in headless mode | ||
| GET {{base}}{{documentation_url}} | ||
| HTTP 200 | ||
| [Asserts] | ||
| header "ETag" exists | ||
| header "Last-Modified" exists | ||
| body contains "# Headless Documentation" | ||
| body contains "**test**" | ||
|
|
||
| # Collection without documentation does not have the documentation field | ||
| GET {{base}}/self/v1/api/list/other | ||
| HTTP 200 | ||
| Content-Type: application/json | ||
| Access-Control-Allow-Origin: * | ||
| Link: </self/v1/schemas/api/list/response>; rel="describedby" | ||
| [Captures] | ||
| last_response: body | ||
| schema_path: header "Link" regex "<([^>]+)>" | ||
| [Asserts] | ||
| header "ETag" exists | ||
| header "Last-Modified" exists | ||
| jsonpath "$.path" == "/other" | ||
| jsonpath "$.url" == "{{base}}/other" | ||
| jsonpath "$.schemas" == 1 | ||
| jsonpath "$.health" == 0 | ||
| jsonpath "$.breadcrumb" count == 1 | ||
| jsonpath "$.breadcrumb[0].name" == "other" | ||
| jsonpath "$.breadcrumb[0].path" == "/other/" | ||
| jsonpath "$.documentation" not exists | ||
| jsonpath "$.entries" count == 1 | ||
| jsonpath "$.entries[0].name" == "integer" | ||
| jsonpath "$.entries[0].type" == "schema" | ||
| jsonpath "$.entries[0].path" == "/other/integer" | ||
| jsonpath "$.entries[0].identifier" == "{{base}}/other/integer" | ||
| jsonpath "$.entries[0].bytes" == 132 | ||
| jsonpath "$.entries[0].baseDialect" == "https://json-schema.org/draft/2020-12/schema" | ||
| jsonpath "$.entries[0].dialect" == "https://json-schema.org/draft/2020-12/schema" | ||
| jsonpath "$.entries[0].health" == 0 | ||
| jsonpath "$.entries[0].dependencies" == 0 | ||
| jsonpath "$.entries[0].alert" == null | ||
| jsonpath "$.entries[0].provenance" == null | ||
| jsonpath "$.entries[0].documentation" not exists | ||
|
|
||
| POST {{base}}/self/v1/api/schemas/evaluate{{schema_path}} | ||
| ``` | ||
| {{last_response}} | ||
| ``` | ||
| HTTP 200 | ||
| Link: </self/v1/schemas/api/schemas/evaluate/response>; rel="describedby" | ||
| [Asserts] | ||
| jsonpath "$.valid" == true | ||
|
|
||
| # No HTML pages in headless mode | ||
| GET {{base}}/test | ||
| Accept: text/html | ||
| HTTP 404 | ||
|
|
||
| # Parent listing does not include documentation on child entries | ||
| GET {{base}}/self/v1/api/list | ||
| HTTP 200 | ||
| Content-Type: application/json | ||
| Access-Control-Allow-Origin: * | ||
| Link: </self/v1/schemas/api/list/response>; rel="describedby" | ||
| [Captures] | ||
| last_response: body | ||
| schema_path: header "Link" regex "<([^>]+)>" | ||
| [Asserts] | ||
| header "ETag" exists | ||
| header "Last-Modified" exists | ||
| jsonpath "$.path" == "/" | ||
| jsonpath "$.url" == "{{base}}" | ||
| jsonpath "$.breadcrumb" count == 0 | ||
| jsonpath "$.health" == 33 | ||
| jsonpath "$.schemas" == 33 | ||
| jsonpath "$.documentation" not exists | ||
| jsonpath "$.entries" count == 3 | ||
| jsonpath "$.entries[0].name" == "other" | ||
| jsonpath "$.entries[0].type" == "directory" | ||
| jsonpath "$.entries[0].health" == 0 | ||
| jsonpath "$.entries[0].schemas" == 1 | ||
| jsonpath "$.entries[0].path" == "/other/" | ||
| jsonpath "$.entries[0].documentation" not exists | ||
| jsonpath "$.entries[1].name" == "self" | ||
| jsonpath "$.entries[1].type" == "directory" | ||
| jsonpath "$.entries[1].health" == 100 | ||
| jsonpath "$.entries[1].schemas" == 31 | ||
| jsonpath "$.entries[1].path" == "/self/" | ||
| jsonpath "$.entries[1].title" == "Self" | ||
| jsonpath "$.entries[1].description" == "The schemas that define the current version of this instance" | ||
| jsonpath "$.entries[1].documentation" not exists | ||
| jsonpath "$.entries[2].name" == "test" | ||
| jsonpath "$.entries[2].type" == "directory" | ||
| jsonpath "$.entries[2].health" == 0 | ||
| jsonpath "$.entries[2].schemas" == 1 | ||
| jsonpath "$.entries[2].path" == "/test/" | ||
| jsonpath "$.entries[2].documentation" not exists | ||
|
|
||
| POST {{base}}/self/v1/api/schemas/evaluate{{schema_path}} | ||
| ``` | ||
| {{last_response}} | ||
| ``` | ||
| HTTP 200 | ||
| Link: </self/v1/schemas/api/schemas/evaluate/response>; rel="describedby" | ||
| [Asserts] | ||
| jsonpath "$.valid" == true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "url": "http://localhost:8000", | ||
| "html": false, | ||
| "extends": [ "@self/v1" ], | ||
| "contents": { | ||
| "test": { | ||
| "baseUri": "https://example.com/schemas", | ||
| "path": "./schemas/test", | ||
| "x-sourcemeta-one:documentation": "./docs/test-readme.md" | ||
| }, | ||
| "other": { | ||
| "baseUri": "https://example.com/other", | ||
| "path": "./schemas/other" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://example.com/other/integer", | ||
| "type": "integer" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://example.com/schemas/string", | ||
| "type": "string" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Test Collection | ||
|
|
||
| This is a collection of **test schemas** used for validation. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| Check out the [example guide](https://example.com/guide) for more details. | ||
|
|
||
| - Item one with *emphasis* | ||
| - Item two with `inline code` | ||
| - Item three | ||
|
|
||
| ## Security Test | ||
|
|
||
| The following should be filtered: <script>alert('xss')</script> | ||
|
|
||
| And this too: <iframe src="evil"></iframe> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.