Skip to content

Commit

Permalink
♻️ refactor: Refactor conversion scripts and fix broken links
Browse files Browse the repository at this point in the history
This commit refactors the conversion scripts and fixes broken links in the codebase. The changes include:

- In `convert.d/2.2.1/16-types.sh`:
  - Modified the sed commands to fix text formatting issues.
  - Commented out a sed command that was removing a specific file path.

- In `convert.d/libs/links.sh`:
  - Updated various links to fix broken references.
  - Replaced outdated link prefixes with correct ones.

Additionally, a link in `convert.d/libs/links.sh` pointing to "https://ev-protocols" was modified to correctly reference the changelog in "changelog.asciidoc#changelog_changelog".
  • Loading branch information
Alexis Sanchez committed Aug 28, 2023
1 parent 78b769c commit b25308e
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 196 deletions.
2 changes: 1 addition & 1 deletion convert.d/2.2.1/16-types.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function fix_types() {
gsed -i "s|^\`\`\`\stext|\`\`\`text|gm" "$file"
gsed -i -z "s|\`\`\`text\n{|\`\`\`json\n{|gm" "$file"

gsed -i -z "s|/ocpi/07-types/01-intro.md||gm" "$file"
# gsed -i -z "s|/ocpi/07-types/01-intro.md||gm" "$file"

docker container run -i darkriszty/prettify-md < "$file" > "$tempfile"
mv "$tempfile" "$file"
Expand Down
8 changes: 4 additions & 4 deletions convert.d/libs/links.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function links(){
replace "<<docs/ocpi/04-transport-and-format/01-json-http-implementation-guide.md#response-format," "<<transport_and_format.asciidoc#transport_and_format_response_format," "$file"
replace "<<docs/ocpi/04-transport-and-format/01-json-http-implementation-guide.md#response-format," "<<transport_and_format_response_format," "$file"

replace "<<docs/ocpi/05-status-codes/05-status-codes.md#2xxx-client-errors," "<<status_codes.asciidoc#status_codes_2xxx_client_errors," "$file"
replace "<<docs/ocpi/05-status-codes/05-status-codes.md#3xxx-server-errors," "<<status_codes.asciidoc#status_codes_3xxx_server_errors," "$file"
replace "<<docs/ocpi/05-status-codes/05-status-codes.md," "<<status_codes.asciidoc#status_codes_status_codes," "$file"
replace "<<docs/ocpi/05-status-codes/01-status-codes.md#2xxx-client-errors," "<<status_codes.asciidoc#status_codes_2xxx_client_errors," "$file"
replace "<<docs/ocpi/05-status-codes/01-status-codes.md#3xxx-server-errors," "<<status_codes.asciidoc#status_codes_3xxx_server_errors," "$file"
replace "<<docs/ocpi/05-status-codes/01-status-codes.md," "<<status_codes.asciidoc#status_codes_status_codes," "$file"

replace "<<docs/ocpi/06-modules/01-versions/01-intro.md," "<<version_information_endpoint.asciidoc#versions_module," "$file"
replace "<<docs/ocpi/06-modules/01-versions/02-information-endpoint.md#version-class," "<<version_information_endpoint_version_class," "$file"
Expand Down Expand Up @@ -234,6 +234,6 @@ function links(){
replace "<<docs/ocpi/07-types/01-intro.md#string-type," "<<types_string_type," "$file"
replace "<<docs/ocpi/07-types/01-intro.md#url-type," "<<types.asciidoc#types_url_type," "$file"

replace "<<https://EV-protocols," "<<changelog.asciidoc#changelog_changelog," "$file"
replace "<<https://ev-protocols," "<<changelog.asciidoc#changelog_changelog," "$file"

}
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ status code, this way blocking client access to objects that do not belong to th

When a client pushes a Client Owned Object, but the `object-id` in the URL is different from the id in the object being
pushed, server implementations are advised to return an [OCPI status
code](/docs/ocpi/05-status-codes/05-status-codes.md): [2001](/docs/ocpi/05-status-codes/05-status-codes.md).
code](/docs/ocpi/05-status-codes/01-status-codes.md): [2001](/docs/ocpi/05-status-codes/01-status-codes.md).

## Client Owned Object Pull

Expand All @@ -293,15 +293,15 @@ the following properties:
| Property | Type | Card. | Description |
|----------------|-----------------------------------------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| data | Array or Object or String | \* or ? | Contains the actual response data object or list of objects from each request, depending on the cardinality of the response data, this is an array (card. \* or +), or a single object (card. 1 or ?) |
| status_code | int | 1 | OCPI status code, as listed in [Status Codes](/docs/ocpi/05-status-codes/05-status-codes.md), indicates how the request was handled. To avoid confusion with HTTP codes, OCPI status codes consist of four digits. |
| status_code | int | 1 | OCPI status code, as listed in [Status Codes](/docs/ocpi/05-status-codes/01-status-codes.md), indicates how the request was handled. To avoid confusion with HTTP codes, OCPI status codes consist of four digits. |
| status_message | [string](/docs/ocpi/07-types/01-intro.md#string-type) | ? | An optional status message which may help when debugging. |
| timestamp | [DateTime](/docs/ocpi/07-types/01-intro.md#datetime-type) | 1 | The time this message was generated. |

For brevity's sake, any further examples used in this specification will only contain the value of the "data" field. In
reality, it will always have to be wrapped in the above response format.

When a request cannot be accepted, the type response depends on the type of error. For more information see: [Status
codes](/docs/ocpi/05-status-codes/05-status-codes.md)
codes](/docs/ocpi/05-status-codes/01-status-codes.md)

For errors on the HTTP layer, use HTTP error response codes, including the response format above, that contains more
details. HTTP status codes are described on [w3.org](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).
Expand Down
4 changes: 2 additions & 2 deletions website/docs/ocpi/06-modules/02-credentials/03-use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ once a month, in case it was not detected that the credentials where compromised
## Errors during registration

When the server connects back to the client during the credentials registration, it might encounter problems. When this
happens, the server should add the status code [3001](/docs/ocpi/05-status-codes/05-status-codes.md#3xxx-server-errors)
happens, the server should add the status code [3001](/docs/ocpi/05-status-codes/01-status-codes.md#3xxx-server-errors)
in the response to the POST from the client.

## Required endpoints not available
Expand All @@ -75,4 +75,4 @@ to send the POST request with credentials to the Receiver. Log a message/notify
administrator of the Receiver platform.

In case the Receiver platform that cannot find the endpoints it expects, then it is expected to respond to the request
with the status code [3003](/docs/ocpi/05-status-codes/05-status-codes.md#3xxx-server-errors).
with the status code [3003](/docs/ocpi/05-status-codes/01-status-codes.md#3xxx-server-errors).
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ When the eMSP does not know the Token, the eMSP SHALL respond with an HTTP statu

When the eMSP receives a *real-time* authorization request from a CPO that contains too little information (no
LocationReferences provided) to determine if the Token might be used, the eMSP SHALL respond with the OCPI status:
[2002](/docs/ocpi/05-status-codes/05-status-codes.md#2xxx-client-errors)
[2002](/docs/ocpi/05-status-codes/01-status-codes.md#2xxx-client-errors)

#### Request Parameters

Expand Down
16 changes: 8 additions & 8 deletions website/docs/ocpi/07-types/01-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Example of how timestamps shall be formatted in OCPI, other formats/patterns are

## DisplayText *class*

| Property | Type | Card. | Description |
|----------|----------------------------------|-------|-------------------------------------------------------------------|
| language | [string](/docs#string-type)(2) | 1 | Language Code ISO 639-1. |
| text | [string](/docs#string-type)(512) | 1 | Text to be displayed to a end user. No markup, html etc. allowed. |
| Property | Type | Card. | Description |
|----------|------------------------------------------------------------|-------|-------------------------------------------------------------------|
| language | [string](/docs/ocpi/07-types/01-intro.md#string-type)(2) | 1 | Language Code ISO 639-1. |
| text | [string](/docs/ocpi/07-types/01-intro.md#string-type)(512) | 1 | Text to be displayed to a end user. No markup, html etc. allowed. |

Example:

Expand All @@ -55,10 +55,10 @@ large amount* of digits.

## Price *class*

| Property | Type | Card. | Description |
|----------|-----------------------------|-------|---------------------------|
| excl_vat | [number](/docs#number-type) | 1 | Price/Cost excluding VAT. |
| incl_vat | [number](/docs#number-type) | ? | Price/Cost including VAT. |
| Property | Type | Card. | Description |
|----------|-------------------------------------------------------|-------|---------------------------|
| excl_vat | [number](/docs/ocpi/07-types/01-intro.md#number-type) | 1 | Price/Cost excluding VAT. |
| incl_vat | [number](/docs/ocpi/07-types/01-intro.md#number-type) | ? | Price/Cost including VAT. |

## Role *enum*

Expand Down
Loading

0 comments on commit b25308e

Please sign in to comment.