Skip to content
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

Now generating API method documentation from OpenAPI schema. #119

Merged
merged 63 commits into from
Mar 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3547a58
feat: rest-api generated with openapi.yaml
schuur Feb 18, 2025
3a7a8f8
docs: moved intro text on API to index.md. Rest of the text will be g…
schuur Feb 26, 2025
fe3e2ac
docs: typo and styling
schuur Feb 26, 2025
81c4d7f
feat: adapted script for generating api, included documentation
schuur Feb 26, 2025
4a667b8
docs: Action Events returns 200 with empty body
schuur Feb 26, 2025
c4f9601
docs: Error and FilterCriteria now standalone types, used by API
schuur Feb 26, 2025
46baee9
docs: Events plural typo
schuur Feb 26, 2025
7b9572c
fix: styling of dt code term
schuur Feb 26, 2025
e73f573
docs: included details on ListFootprints
schuur Feb 26, 2025
fd72b51
feat: generate parameter + type descriptions
schuur Feb 26, 2025
b04c0b5
docs: incorporated details on ListFootprints and GetFootprint from d…
schuur Feb 27, 2025
759e678
docs: clarified limit and filter parameters for ListFootprints
schuur Mar 4, 2025
56be0a6
feat: added generation of request bodies and recursive description of…
schuur Mar 4, 2025
122c476
docs: Event api objects now correctly structured
schuur Mar 4, 2025
71c7a56
docs: Error object sample added
schuur Mar 4, 2025
a001fea
docs: typos and references in openapi fixed
schuur Mar 4, 2025
295ed08
docs: added documentation on RequestCreatedEvent and RequestFulfilled…
schuur Mar 5, 2025
d2da4c1
docs: updated the CE event type identifiers to a new v3 version.
schuur Mar 5, 2025
ab2a18e
docs: clarification on empty result from ListFootprints
schuur Mar 5, 2025
2c682c8
docs: deduplication of filter parameters which are used by ListFootpr…
schuur Mar 5, 2025
7c66007
docs: clarification on async diagram
schuur Mar 5, 2025
2835434
fix: make sure to omit query string sample if not query parameters ar…
schuur Mar 5, 2025
2a8ed91
docs: added RequestRejected documentation
schuur Mar 5, 2025
23d2d83
fix: h4 heading in header-color and slighty bigger
schuur Mar 5, 2025
6ba6911
docs: completed GetFootprint description
schuur Mar 6, 2025
99c10ea
docs: removed duplicate example
schuur Mar 6, 2025
769270c
docs: added Error handling section
schuur Mar 7, 2025
f6cc633
docs: condensed host requirements
schuur Mar 7, 2025
60dbe67
docs: error handling refers to OAuth spec
schuur Mar 7, 2025
7c7774c
docs: simplified Authentication section
schuur Mar 7, 2025
b4f86ea
docs: references added in authentication flow.
schuur Mar 8, 2025
4e4f800
docs: condensed requirements
schuur Mar 8, 2025
34409a3
fix: removed hardcoded text from script, no relying on description in…
schuur Mar 8, 2025
fdc91b5
docs: expanded info on ListFootprints and GetFootprint responses
schuur Mar 8, 2025
0923b4c
docs: added requirement on having one fullfilled event per request e…
schuur Mar 8, 2025
f5cddf3
docs: fixed typo in RequestRejectedEvent sample
schuur Mar 8, 2025
1608936
docs: moved error object requirement to the individual responses
schuur Mar 8, 2025
739831b
fix: replace print with logging.debug
schuur Mar 9, 2025
5669510
fix: markdown fixes
schuur Mar 9, 2025
3de2a86
feat: write_property can now not define terms (with dfn)
schuur Mar 10, 2025
fb7e71c
docs: moved examples to index.md
schuur Mar 10, 2025
f9ff3d5
docs: removed optional operationId
schuur Mar 10, 2025
86df842
docs: fixed references to examples
schuur Mar 10, 2025
a9f2951
docs: fixed samples
schuur Mar 10, 2025
092f36d
docs: fixed event identifier in sample
schuur Mar 10, 2025
214cb04
docs: clean up of dead links
schuur Mar 10, 2025
296ac60
docs: adapting links
schuur Mar 10, 2025
cacbfe5
feat: custom.css now overrides markdown.css
schuur Mar 10, 2025
6c4101d
docs: updated dates
schuur Mar 10, 2025
648c2ef
docs: date updated
schuur Mar 10, 2025
516af81
docs: fixed heading level for examples
schuur Mar 10, 2025
317ec93
docs: intro api refers to general section on exchanging pcfs.
schuur Mar 10, 2025
3774a0f
docs: Fixed typo in link
schuur Mar 10, 2025
d9494de
fix: remove indententation for html elements in markdown. will maximi…
schuur Mar 11, 2025
8270af7
fix: include <dfn> for API operation definitions , so [= =] links wor…
schuur Mar 12, 2025
1d4385a
docs: fixed numerous typos, kudos @bhadley!
schuur Mar 12, 2025
a033513
docs: fixed HTTP samples
schuur Mar 13, 2025
5cc129e
docs: added retry information to RequestCreatedEvent and PublishedEve…
schuur Mar 13, 2025
d113e50
docs: clarify definition of change of property
schuur Mar 13, 2025
0c3ed0e
docs: fixed 2->3 url in sample
schuur Mar 13, 2025
7f48c23
docs: remove obsolete methodology links
schuur Mar 13, 2025
f0ccfff
docs: included retry description for callback events to data-recipients
schuur Mar 13, 2025
4045671
chore: changelog updated
schuur Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: fixed numerous typos, kudos @bhadley!
schuur committed Mar 12, 2025
commit 1d4385a6bd30e7661a85c0efed2a4066cb5b8d1c
50 changes: 10 additions & 40 deletions spec/v3/index.md
Original file line number Diff line number Diff line change
@@ -682,7 +682,7 @@ The scope of the HTTP API is minimal by design. Additional features will be adde
A host system serves the needs of a single or multiple [=data owners=]. Additionally, a host system can also serve the needs of [=data recipients=] if it retrieves data from other host systems by calling their API.

In other words, any host system which implements the API endpoints as described in this specification can play
the role of [=data owner=] as well as of [=data recipient=], thus mirroring real-world supply chains, also see [[#business-cases]]
the role of [=data owner=] as well as of [=data recipient=], thus mirroring real-world supply chains. See [[#business-cases]] for more details.

A [=host system=] MUST implement the following actions:

@@ -691,7 +691,7 @@ A [=host system=] MUST implement the following actions:
- [Action GetFootprint](#action-getfootprint)
- [Action Events](#action-events)

The host system MUST make its footprints available to the data recipient through BOTH [=Action ListFootprints=] AND [=Action Event=].
The host system MUST make its footprints available to the data recipient through BOTH [=Action ListFootprints=] AND [=Action Events=].

A [=host system=] MUST offer its actions over HTTPS only.

@@ -726,11 +726,11 @@ The following section briefly describes some of the additional functionality whi

## Error Handling ## {#api-error-handling}

[he actions [GetFootprint](#action-getfootprint), [ListFootprints](#action-listfootprints) and [Events](#action-events) MUST return an appropriate HTTP status code and MUST include a JSON <{Error}> object with information on the error.
The actions [GetFootprint](#action-getfootprint), [ListFootprints](#action-listfootprints) and [Events](#action-events) MUST return an appropriate HTTP status code and MUST include a JSON <{Error}> object with information on the error.

Error responses are specified in detail such that data recipients can understand the cause of the error, and so that potentially host systems can react on and resolve errors automatically.
Error responses are specified in detail such that data recipients can understand the cause of the error, and so that potentially host systems can act on and resolve errors automatically.

Error responses from [Action Auth](#api-auth) follow the OAuth specification [[!rfc6750]]. See [[#api-auth]]
Error responses from [Action Authenticate](#api-auth) follow the OAuth specification [[!rfc6750]]. See [[#api-auth]]


## Authentication Flow ## {#api-auth}
@@ -752,10 +752,10 @@ If provided by the host system, this document contains the `token_endpoint` to b

If no OpenID configuration is provided by the host system, clients MUST assume `$auth-base-url$/auth/token` to be the token endpoint.

After determining the token endpoint, clients MUST obtain by making a request to:
After determining the token endpoint, clients MUST obtain an access token by making a request to:

```
POST $token-endpoint$
```http
POST $token-endpoint$
```

with the following request parameters:
@@ -806,47 +806,17 @@ GET <base-url>/protected-resource
Authorization: Bearer <access_token>
```

The host system MUST check the Access Token and return an 401 when it has expired or is invaliud.
The host system MUST check the Access Token and return a 401 when it has expired or is invalid.

[=Access tokens=] SHOULD expire. In this case, data recipients MUST retrieve a new [=access token=]
Access tokens SHOULD expire. In this case, data recipients MUST retrieve a new [access token](#obtaining-an-access-token)
as described in this section.

<!--
A [=host system=] requires a [=data recipient=] to first authenticate before successfully calling an Action (such as [=Action ListFootprints=] or [=Action Events=]). The [=data recipient=] MUST perform the <dfn>authentication flow</dfn>:
1. data recipient attempting to perform the OpenId Connect-based flow, by
1. retrieving and validating the [=OpenId Provider Configuration Document=] of the host system (see [[!OPENID-CONNECT]]), and then
2. using as [=AuthEndpoint=] the value of the `token_endpoint` property of the [=OpenId Provider Configuration Document=]
2. otherwise, data recipient using [=AuthHostname=]`/`[=AuthSubpath=]`/auth/token` as the [=AuthEndpoint=] in the next step.
3. data recipient retrieving the [=access token=] from [=AuthEndpoint=] (see [[#api-action-auth-request]]).
Note: The [=authentication flow=] is defined such that a Version [VERSION] data recipient can authenticate against host versions irrespective of their support for OpenID-Connect.
<figure>
<img src="diagrams/authentication-flow.svg" height="100%" width="100%" >
<figcaption>Authentication flow.</figcaption>
</figure>
Once the [=authentication flow=] is complete, the [=data recipient=] can call the other actions of the [=host system=]
- using the value of `access_token` of the response of the [=Action Authenticate=] call as the
value for a [[!rfc6750]] <dfn>Bearer token</dfn>
- presenting the Bearer token for subsequent call(s) to the host system in accordance with
[[!rfc6750]] Section 2.1
-->


<pre class=include>
path: rest-api.generated.md
</pre>


<!--
<pre class=include>
path: rest-api.md
</pre>
-->

# Examples # {#api-examples}

<div class=note>Non-normative</div>
34 changes: 16 additions & 18 deletions spec/v3/openapi.yaml
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ paths:
ProductFootprints ready to be retrieved, such that
- The `Link` header conforms to [[!RFC8288]]
- The value of the `rel` parameter is equal to `next`
- the target URI (RFC8288, section 3.1) of the `Link` header is absolute
- the target URI of the `Link` header is absolute
- The value of `host` of the target URI is equal to the value of the `host`
request header from the original `ListFootprints` HTTP request
3. The target URI from the `Link` header is called a <dfn>pagination link</dfn>.
@@ -67,7 +67,7 @@ paths:
7. If a response contains a second pagination link and the data recipient has called
that second pagination link, the previous pagination link MAY no longer work: data
recipients MUST NOT assume that previous pagination links continue to return results
after advancing in the pagination process
after advancing in the pagination process.
### Filtering
@@ -185,10 +185,10 @@ paths:
same `id`, it MUST include only the latest version in the list of footprints.
If the requested ProductFootprint is deprecated, the host system SHOULD
return the deprecated ProductFootprint.
return the deprecated ProductFootprint, if it is still available.
If the requested ProductFootprint is not found, the host system MUST return
an 404 Not Found response.
a 404 Not Found response.
Host systems SHOULD implement an access management system and only
return the product footprints for which the data owner granted access
@@ -260,7 +260,7 @@ paths:
post:
summary: Action Events
description: |
The Action Events endpoint supports for the following use cases:
The Action Events endpoint supports the following use cases:
1. enabling a [=data recipient=] to request Product Footprints
from a [=data owner=] by sending a `RequestCreatedEvent`, to
@@ -270,7 +270,7 @@ paths:
updates to 1 or more Product Footprints: `PublishedEvent`
The Action Events endpoint accepts CloudEvent events (see [[!CE]]) encoded
in "Structured Content Mode" (see [[!CE-Structured-Content-Mode]].
in "Structured Content Mode" (see [[!CE-Structured-Content-Mode]]).
The CloudEvents are encoded in the "application/cloudevents+json" media type and
MUST be sent as an HTTP POST request body to the Action Events endpoint.
@@ -376,7 +376,7 @@ components:
precedingPfIds:
description: |
A given PCF may change over time, due to updates to the calculation.
This is a list of ID's that reflect "past versions" of the current PCF,
This is a list of IDs that reflect "past versions" of the current PCF,
maintained by the solution.
See [[#lifecycle]] for details.
@@ -1463,17 +1463,15 @@ components:
$ref: '#/components/schemas/BaseEvent'
title: Request Created Event
description: |
A data recipient request a ProductFootprint from the data owner. The data recipient
A data recipient requests a ProductFootprint from the data owner. The data recipient
MUST provide the criteria in the data object to enable the data owner to either
find an existing relevant PCF or create a new one.
Criteria to provide can be product id, geography, company identifier, validity
period, etc.
The data owner MUST validate the input parameters, including these criteria.
If the data owner can *immediately* determine that it will not be able to
handle this request it MUST respond with an appropriate `4xxx` error response,
handle this request it MUST respond with an appropriate `4xx` error response,
otherwise it MUST respond directly with a `200` (Success) or `202` (Accepted).
In the latter case, the data owner MUST send a follow up event to the data
@@ -1773,7 +1771,7 @@ components:

securitySchemes:
BearerAuth:
description: OAuth2 Client Credentials Grant (RFC6749 4.4)
description: OAuth2 Client Credentials Grant ([[!RFC6749]] 4.4)
type: oauth2
flows:
clientCredentials:
@@ -1785,7 +1783,7 @@ components:
parameters:
productId:
name: productId
description: One or more product ID's. Will return all footprints which have a corresponding ID in their `productIds` attribute. Note that a footprint itself can also have multiple product IDs.
description: One or more product IDs. Will return all footprints which have a corresponding ID in their `productIds` attribute. Note that a footprint itself can also have multiple product IDs.
in: query
explode: true
schema:
@@ -1794,7 +1792,7 @@ components:
$ref: '#/components/schemas/Urn'
companyId:
name: companyId
description: One or more company ID's. Will return all footprints which have a corresponding ID in their `companyId` attribute.
description: One or more company IDs. Will return all footprints which have a corresponding ID in their `companyId` attribute.
in: query
explode: true
schema:
@@ -1822,31 +1820,31 @@ components:
validOn:
name: validOn
description: |
If present, MUST match all PCFs which where valid on the date specified: footprint.validityPeriodBegin <= validOn AND validFrom <= footprint.validityPeriodEnd
If present, MUST match all PCFs which were valid on the date specified: footprint.validityPeriodBegin <= validOn AND validFrom <= footprint.validityPeriodEnd
in: query
schema:
type: string
format: date-time
validAfter:
name: validAfter
description: |
if present, MUST match PCFs whith validAfter < footprint.validityPeriodBegin
If present, MUST match PCFs with validAfter < footprint.validityPeriodBegin
in: query
schema:
type: string
format: date-time
validBefore:
name: validBefore
description: |
if present, MUST match PCFs whith validBefore > footprint.validityPeriodEnd
If present, MUST match PCFs with validBefore > footprint.validityPeriodEnd
in: query
schema:
type: string
format: date-time
status:
name: status
description: |
if present, MUST be either be "Active" or "Deprecated"
If present, MUST be "Active" or "Deprecated". If not specified, will return footprints regardless of status.
in: query
schema:
type: string