Skip to content

Commit

Permalink
Merge pull request #439 from ConsumerDataStandardsAustralia/defect/438
Browse files Browse the repository at this point in the history
Staging #438 - Improve code samples
  • Loading branch information
nils-work authored Oct 21, 2024
2 parents 4f1cbd8 + bb7d13e commit a80ef07
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 37 deletions.
9 changes: 9 additions & 0 deletions slate/source/includes/_register.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ These endpoints are exposed by the Register and consumed by Data Holders and Dat
These statuses are provided authoritatively by the Register to allow participants to determine whether a connecting third-party is permitted to perform registration requests or data sharing requests.
</aside>

```diff
Updated the server URL placeholder in the Register spec to refer to the actual Base URLs
- "url": "https://<register-base-url>/"

+ "url": "https://api.cdr.gov.au"
+ "description": "Production TLS"

+ "url": "https://secure.api.cdr.gov.au"
+ "description": "Production MTLS"
```

<br>
<table>
Expand Down
4 changes: 4 additions & 0 deletions slate/source/includes/introduction/_references.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

## Informative References

```diff
Improved styling of 'Code samples' displayed in the Non-Normative Examples tab
```

| **Reference** | **Description** |
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| <a id="iref-ACCC"></a>**[ACCC]** | The Australian Competition and Consumer Commission is responsible for accrediting data recipients to participate in CDR, building and maintaining the Register of data recipients and data holders, providing support and guidance to participants and promoting compliance with the CDR rules and standards, including taking enforcement action where necessary.<br/><https://www.accc.gov.au/focus-areas/consumer-data-right-cdr-0> |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This release addresses the following minor defects raised on [Standards Staging]
- [Standards Staging #418 - Add a link to CX Guidelines to the left menu pane of the Standards](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/418)
- [Standards Staging #419 - Field name styling](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/419)
- [Standards Staging #426 - Error in Telco OAS components](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/426)
- [Standards Staging #438 - Improve code sample section styling](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/438)

This release addresses the following change requests raised on [Standards Maintenance](https://github.com/ConsumerDataStandardsAustralia/standards-maintenance/issues):

Expand All @@ -44,6 +45,7 @@ This release addresses the following Decision Proposals published on [Standards]
| Change summary | [**Decision Proposal #XXX**](https://github.com/ConsumerDataStandardsAustralia/standards/issues/XXX): Change detail | [Standards section](../../#section)
| Changelog section | [**Standards Staging #413**](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/413): Merged the Change Log and Archives sections | [Changelog and archives](../../#changelog-and-archives)
| Add CX Guidelines link | [**Standards Staging #418**](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/418): Added CX Guidelines link to side/footer navigation | [Introduction](../../#introduction)
| Improve Code sample styling | [**Standards Staging #438**](https://github.com/ConsumerDataStandardsAustralia/standards-staging/issues/438): Improved styling of 'Code samples' displayed in the Non-Normative Examples tab and updated the Register server URL in the OpenAPI specification to refer to the actual Base URLs | [Code samples throughout](../../?examples)<br>[Register APIs](../../?diff#register-apis)
| Adjustment rate format clarification | [**Standards Maintenance #641**](https://github.com/ConsumerDataStandardsAustralia/standards-maintenance/issues/641): Clarified the format of 'bonus', 'discount' and 'penalty' adjustment rate values | [Deposit Adjustment Rate Types](../../#tocSproductdepositadjustmentratetypedoc)<br>[Lending Adjustment Rate Types](../../#tocSproductlendingadjustmentratetypedoc)


Expand Down
10 changes: 5 additions & 5 deletions slate/source/stylesheets/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ under the License.
// BACKGROUND COLORS
////////////////////
$nav-bg: #000000 !default;
$examples-bg: #2E3336 !default;
$code-bg: #1E2224 !default;
$code-annotation-bg: #191D1F !default;
$examples-bg: #444 !default;
$code-bg: #222 !default;
$code-annotation-bg: #333 !default;
$nav-subitem-bg: #1E2224 !default;
$nav-active-bg: #00A9CE !default;
$nav-active-parent-bg: #1E2224 !default; // parent links of the current section
$nav-active-parent-bg: #222 !default; // parent links of the current section
$lang-select-border: #000 !default;
$lang-select-bg: #1E2224 !default;
$lang-select-bg: #222 !default;
$lang-select-active-bg: $examples-bg !default; // feel free to change this to blue or something
$lang-select-pressed-bg: #111 !default; // color of language tab bg when mouse is pressed
$main-bg: #F3F7F9 !default;
Expand Down
5 changes: 3 additions & 2 deletions slate/source/stylesheets/screen.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -640,13 +640,14 @@ html, body {
@extend %code-font;
padding-top: 2em;
padding-bottom: 2em;
padding: 2em $main-padding;
padding: 1.5em $main-padding;
}

blockquote {
&>p {
background-color: $code-annotation-bg;
padding: $code-annotation-padding 2em;
/* padding: $code-annotation-padding 2em; */
padding: 0.6em 2em 0.8em 2em;
color: #eee;
}
}
Expand Down
15 changes: 14 additions & 1 deletion swagger-gen/api/cds_register.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
},
"servers": [
{
"url": "https://<register-base-url>/"
"url": "https://api.cdr.gov.au",
"description": "Production TLS"
}
],
"tags": [],
Expand Down Expand Up @@ -57,6 +58,12 @@
},
"/cdr-register/v1/{industry}/data-holders/brands": {
"get": {
"servers": [
{
"url": "https://secure.api.cdr.gov.au",
"description": "Production MTLS"
}
],
"tags": [
"Register"
],
Expand Down Expand Up @@ -321,6 +328,12 @@
},
"/cdr-register/v1/{industry}/data-recipients/brands/{dataRecipientBrandId}/software-products/{softwareProductId}/ssa": {
"get": {
"servers": [
{
"url": "https://secure.api.cdr.gov.au",
"description": "Production MTLS"
}
],
"tags": [
"Register"
],
Expand Down
10 changes: 5 additions & 5 deletions swagger-gen/widdershins-cdr/openapi3.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,17 @@ function getBodyParameterExamples(data) {
}
if (common.doContentType(data.consumes, 'json')) {
content += '```json\n';
content += safejson(obj,null,2) + '\n';
content += safejson(obj,null,2).replace(/\n+$/, '') + '\n';
content += '```\n\n';
}
if (common.doContentType(data.consumes, 'yaml')) {
content += '```yaml\n';
content += yaml.safeDump(obj) + '\n';
content += yaml.safeDump(obj).replace(/\n+$/, '') + '\n';
content += '```\n\n';
}
if (common.doContentType(data.consumes, 'form')) {
content += '```yaml\n';
content += yaml.safeDump(obj) + '\n';
content += yaml.safeDump(obj).replace(/\n+$/, '') + '\n';
content += '```\n\n';
}
if (common.doContentType(data.consumes, 'xml') && (typeof obj === 'object')) {
Expand Down Expand Up @@ -512,12 +512,12 @@ function getResponseExamples(data) {
}
if (common.doContentType(example.cta, 'json')) {
content += '```json\n';
content += safejson(example.value, null, 2) + '\n';
content += safejson(example.value, null, 2).replace(/\n+$/, '') + '\n';
content += '```\n\n';
}
if (common.doContentType(example.cta, 'yaml')) {
content += '```yaml\n';
content += yaml.safeDump(example.value) + '\n';
content += yaml.safeDump(example.value).replace(/\n+$/, '') + '\n';
content += '```\n\n';
}
let xmlObj = example.value;
Expand Down
12 changes: 5 additions & 7 deletions swagger-gen/widdershins-cdr/templates/openapi3/code_http.dot
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{=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}}
{{~}}
{{?}}
{{=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}}{{~}}{{?}}
24 changes: 11 additions & 13 deletions swagger-gen/widdershins-cdr/templates/openapi3/code_nodejs.dot
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
const fetch = require('node-fetch');
{{?data.bodyParameter.present}}const inputBody = '{{=data.bodyParameter.exampleValues.json}}';{{?}}
{{?data.allHeaders.length}}const headers = {
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) {

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);
});
});
6 changes: 2 additions & 4 deletions swagger-gen/widdershins-cdr/templates/openapi3/main.dot
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@

{{? data.options.yaml }}
```yaml
{{=data.utils.yaml.safeDump(data.utils.getSample(schema,data.options,{},data.api))}}
{{??}}
{{=data.utils.yaml.safeDump(data.utils.getSample(schema,data.options,{},data.api))}}{{??}}
```json
{{=data.utils.safejson(data.utils.getSample(schema,data.options,{},data.api),null,2)}}
{{?}}
{{=data.utils.safejson(data.utils.getSample(schema,data.options,{},data.api),null,2)}}{{?}}
```

{{ var enums = []; }}
Expand Down
3 changes: 3 additions & 0 deletions swagger-gen/widdershins-cdr/templates/openapi3/operation.dot
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{{?}}

{{ data.methodUpper = data.method.verb.toUpperCase(); }}
{{ data.orig_baseUrl = data.orig_baseUrl || data.baseUrl; }}
{{ data.baseUrl = (data.operation.servers && data.operation.servers[0].url) || data.orig_baseUrl; }}
{{ data.host = data.baseUrl.replace(/^https?:\/\//, '').split('/', 1)[0].toLowerCase(); }}
{{ data.url = data.utils.slashes(data.baseUrl + data.method.path); }}
{{ data.parameters = data.operation.parameters; }}
{{ data.enums = []; }}
Expand Down

0 comments on commit a80ef07

Please sign in to comment.