Skip to content

Commit 4fdaeea

Browse files
added links to parent document objects
1 parent 743263d commit 4fdaeea

File tree

2 files changed

+40
-28
lines changed

2 files changed

+40
-28
lines changed

versions/smartapi-list.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
Object | Field | Recommendation | Datatype | Description
22
---|:---:|:---:|:---:|---
3-
OpenAPI Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#oasExternalResources">x-externalResources</a>||External Resource Object|A list of external resources pertinent to the API.
4-
Info Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoDescription">description</a>|SHOULD| string |See <a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.mdfixed-fields-1">above</a>.
5-
Info Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoTermsOfService">termsOfService</a>|REQUIRED| URL |See <a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.mdfixed-fields-1">above</a>.
6-
Info Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoVersion">version</a>|REQUIRED| string |The version of the API definition. Specify API version using <a href="http://semver.org/spec/v2.0.0.html">Semantic Versioning<a/>. The major.minor portion of the semver (for example 3.0) shall designate the feature set. Typically, .patch versions address errors in the API metadata, not the feature set.
7-
Info Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoMaturity">x-maturity</a>|| enum |Maturity of the API. Values to use: development, production.
8-
Info Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoAccessRestriction">x-accessRestriction</a>|| enum |Indicate whether there are restrictions to using the API. Values to use: none, limited, fee.
9-
Info Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoImplementationLanguage">x-implementationLanguage</a>|| string |Language the API was written in.
10-
Contact Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#contactRole">x-role</a>|REQUIRED| enum |Indicate the role of the contact. Values can be: `responsible organization`,`responsible developer`,`contributor`,`support`.
11-
Contact Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#contactId">x-id</a>|SHOULD| string |Provide a unique identifier for the contact.
12-
Operation Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operationSummary">summary</a>|REQUIRED| string |See <a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.mdoperation-object">above.</a>
13-
Operation Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operationAccessRestriction">x-accessRestriction</a>|| enum |Access restrictions to invoke the operation. values: none, limited, fee.
14-
External Resource Object [smartAPI extension]|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceUrl">x-url</a>|REQUIRED| string |. The URL for the target documentation. Value MUST be in the format of a URL.
15-
External Resource Object [smartAPI extension]|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceType">x-type</a>|REQUIRED| enum |values: `api documentation`, `website`,`developer forum`,`mailing list`,`social media`,`publication` </a>
16-
External Resource Object [smartAPI extension]|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceDescription">x-description</a>|| string |A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation.
17-
Parameter Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterType">x-parameterType</a>|SHOULD| uri |A concept URI to describe the type of parameter.
18-
Parameter Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterValueType">x-valueType</a>|SHOULD| [uri] |A list of URIs to define the types of accepted value types. These should be selected from a registry of value types such as identifiers.org. This attribute is different from
19-
Parameter Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterDefaultValue">x-defaultValue</a>|| string |Default value.
20-
Parameter Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterExampleValue">x-exampleValue</a>|| string |Example value.
21-
Response Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseContent">content</a>|| Map[string, [Media Type Object](#mediaTypeObject)] |A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it.The media type definitions should be in compliance with <a href="http://tools.ietf.org/html/rfc6838">RFC6838</a>.
22-
Response Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseProfile">x-responseSchema</a>|| URI |Conformance to a particular schema/format.
23-
Response Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseDataType">x-responseValueType</a>|| [responseValueType object] |To specify the types of objects in the response. The responseValueType object consists of a required `x-valueType` that should provide URI values to the type of object, and an optional `x-path` to specify to ___location in the response for that valueType.
24-
Response Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#x-JSONLDContext">x-JSONLDContext</a>|| URI |JSON LD context.
25-
Tag Object|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#tagName">x-id</a>|| URI |The name of the tag. Recommend that you use URI to specify the concept.
3+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#oasObject">OpenAPI Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#oasExternalResources">x-externalResources</a>||External Resource Object|A list of external resources pertinent to the API.
4+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoObject">Info Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoDescription">description</a>|SHOULD| string |See <a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.mdfixed-fields-1">above</a>.
5+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoObject">Info Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoTermsOfService">termsOfService</a>|REQUIRED| URL |See <a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.mdfixed-fields-1">above</a>.
6+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoObject">Info Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoVersion">version</a>|REQUIRED| string |The version of the API definition. Specify API version using <a href="http://semver.org/spec/v2.0.0.html">Semantic Versioning<a/>. The major.minor portion of the semver (for example 3.0) shall designate the feature set. Typically, .patch versions address errors in the API metadata, not the feature set.
7+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoObject">Info Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoMaturity">x-maturity</a>|| enum |Maturity of the API. Values to use: development, production.
8+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoObject">Info Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoAccessRestriction">x-accessRestriction</a>|| enum |Indicate whether there are restrictions to using the API. Values to use: none, limited, fee.
9+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoObject">Info Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#infoImplementationLanguage">x-implementationLanguage</a>|| string |Language the API was written in.
10+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#contactObject">Contact Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#contactRole">x-role</a>|REQUIRED| enum |Indicate the role of the contact. Values can be: `responsible organization`,`responsible developer`,`contributor`,`support`.
11+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#contactObject">Contact Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#contactId">x-id</a>|SHOULD| string |Provide a unique identifier for the contact.
12+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operationObject">Operation Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operationSummary">summary</a>|REQUIRED| string |See <a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.mdoperation-object">above.</a>
13+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operationObject">Operation Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#operationAccessRestriction">x-accessRestriction</a>|| enum |Access restrictions to invoke the operation. values: none, limited, fee.
14+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceObject">External Resource Object [smartAPI extension]</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceUrl">x-url</a>|REQUIRED| string |. The URL for the target documentation. Value MUST be in the format of a URL.
15+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceObject">External Resource Object [smartAPI extension]</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceType">x-type</a>|REQUIRED| enum |values: `api documentation`, `website`,`developer forum`,`mailing list`,`social media`,`publication` </a>
16+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceObject">External Resource Object [smartAPI extension]</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#externalResourceDescription">x-description</a>|| string |A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) can be used for rich text representation.
17+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterObject">Parameter Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterType">x-parameterType</a>|SHOULD| uri |A concept URI to describe the type of parameter.
18+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterObject">Parameter Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterValueType">x-valueType</a>|SHOULD| [uri] |A list of URIs to define the types of accepted value types. These should be selected from a registry of value types such as identifiers.org. This attribute is different from
19+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterObject">Parameter Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterDefaultValue">x-defaultValue</a>|| string |Default value.
20+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterObject">Parameter Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#parameterExampleValue">x-exampleValue</a>|| string |Example value.
21+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseObject">Response Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseContent">content</a>|| Map[string, [Media Type Object](#mediaTypeObject)] |A map containing descriptions of potential response payloads. The key is the media type and the value is used to describe it.The media type definitions should be in compliance with <a href="http://tools.ietf.org/html/rfc6838">RFC6838</a>.
22+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseObject">Response Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseProfile">x-responseSchema</a>|| URI |Conformance to a particular schema/format.
23+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseObject">Response Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseDataType">x-responseValueType</a>|| [responseValueType object] |To specify the types of objects in the response. The responseValueType object consists of a required `x-valueType` that should provide URI values to the type of object, and an optional `x-path` to specify to ___location in the response for that valueType.
24+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#responseObject">Response Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#x-JSONLDContext">x-JSONLDContext</a>|| URI |JSON LD context.
25+
<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#tagObject">Tag Object</a>|<a href="https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#tagName">x-id</a>|| URI |The name of the tag. Recommend that you use URI to specify the concept.

versions/smartapi-list.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
<?php
2+
# a PHP script to generate a markdown document of the smartAPI elements from the full specification document
3+
# creator: Michel Dumontier
24

35
$file = "3.0.0.md";
46
$parent_doc = 'https://github.com/SmartAPI/smartAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md';
57
$str = file_get_contents($file);
68

7-
$list = preg_split("/#### <a name=\"[^\"]+\"><\/a>/",$str, -1); // <a name="[^\"]+"></a>OpenAPI Object
9+
preg_match_all("/#### <a name=\"([^\"]+)\"><\/a>([^\n]+)/",$str, $header_labels);
10+
foreach($header_labels[2] AS $id => $label) {$header_labels[2][$id] = trim($label);}
11+
function getHeaderLink($label)
12+
{
13+
global $header_labels;
14+
echo $label.PHP_EOL;
15+
$id = array_search($label, $header_labels[2]);
16+
return $header_labels[1][$id];
17+
}
18+
$list = preg_split("/#### <a name=\"[^\"]+\"><\/a>/",$str, -1);
19+
820
array_shift($list);
921
array_shift($list);
1022
array_shift($list);
1123
array_shift($list);
1224
array_shift($list);
13-
foreach($list as $item) {
25+
foreach($list as $i => $item) {
1426
$a = explode("\n",$item, 2);
1527
$object_label = trim($a[0]);
16-
28+
1729
// now find the smartapi section
1830
$record = false;
1931
$buf = '';
2032
$a = explode("\n",$a[1]);
2133
foreach($a AS $b) {
22-
// echo "line: $b".PHP_EOL;
2334

2435
if($record === true) {
2536
//if(strlen(trim($b)) == 0) $record = false;
@@ -73,7 +84,8 @@
7384
fwrite($fp,"---|:---:|:---:|:---:|---".PHP_EOL);
7485
foreach($mylist AS $object => $o) {
7586
foreach($o as $field => $field_desc) {
76-
fwrite($fp,$object
87+
fwrite($fp,
88+
'<a href="'.$parent_doc.'#'.getHeaderLink($object).'">'.$object.'</a>'
7789
."|".'<a href="'.$parent_doc.'#'.$field_desc['link'].'">'.$field.'</a>'
7890
."|".$field_desc['rec']
7991
."|".$field_desc['datatype']

0 commit comments

Comments
 (0)