@arc-e-tect/api-only-publisher 0.13.1 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.adoc CHANGED
@@ -6,7 +6,15 @@
6
6
  :source-highlighter: rouge
7
7
  // The released version of this component: its snippets use it. The release
8
8
  // workflow updates it; do not change it by hand.
9
- :api-only-publisher-version: 0.13.1
9
+ :api-only-publisher-version: 0.14.1
10
+
11
+ [NOTE]
12
+ .About this documentation
13
+ ====
14
+ This documentation was partially authored by Claude, an AI assistant.
15
+ Documentation is part of the product, and is held to the same standard as the code it describes.
16
+ If something here seems wrong, please file a bug report: link:https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/issues/new[open an issue in this repository ↗].
17
+ ====
10
18
 
11
19
  image:https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/actions/workflows/nvd-cache-refresh.yml/badge.svg[Vulnerability Scan,link=https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/actions/workflows/nvd-cache-refresh.yml]
12
20
  image:https://img.shields.io/npm/v/@arc-e-tect/api-only-publisher[npm,link=https://www.npmjs.com/package/@arc-e-tect/api-only-publisher]
@@ -1021,11 +1029,19 @@ AsyncAPI operation '<operationId>': message '<messageKey>' (<fragment, or where
1021
1029
  ----
1022
1030
 
1023
1031
  For OpenAPI, it is whether a request body's or response's media type declares `example`/`examples`, or the schema it references carries its own top-level `examples`.
1024
- Nothing downstream currently reads an OpenAPI example, so the message never claims the bundle cannot be used -- only that the generated documentation is weaker without one:
1032
+ The message never claims the bundle cannot be used, and says only what is true for the part.
1033
+ For a request body, the TranscriberJ's contract cases send the example the media type names, or values from the schemas' own examples (link:../api-only-transcriberj/README.adoc#example-data[Example data in the TranscriberJ's README →]); without one they send values it generates:
1034
+
1035
+ [source,text]
1036
+ ----
1037
+ OpenAPI operation '<operationId>': request body (<fragment, or where in the bundle>) carries no example, so the TranscriberJ's contract cases send generated values rather than ones the contract chose, and the generated documentation is harder to read.
1038
+ ----
1039
+
1040
+ Nothing downstream reads a response's example, so for a response only the documentation is weaker without one:
1025
1041
 
1026
1042
  [source,text]
1027
1043
  ----
1028
- OpenAPI operation '<operationId>': <request body, or response <status>> (<fragment, or where in the bundle>) carries no example, which makes the generated documentation harder to read.
1044
+ OpenAPI operation '<operationId>': response <status> (<fragment, or where in the bundle>) carries no example, which makes the generated documentation harder to read.
1029
1045
  ----
1030
1046
 
1031
1047
  A body or response with no `content` at all, such as a `204`, has nothing to exemplify and is never reported.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arc-e-tect/api-only-publisher",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "Builds, packs and publishes API description documents from a library of reusable fragments.",
5
5
  "license": "MIT",
6
6
  "author": "Arc-E-Tect",
package/src/examples.js CHANGED
@@ -16,10 +16,12 @@
16
16
  // Object itself. A message with none cannot be used for Microcks-based conformance
17
17
  // testing at all, so the message says exactly that.
18
18
  //
19
- // OpenAPI: nothing downstream currently reads an example. The TranscriberJ
20
- // processes a bundle without one perfectly well -- bodies take arguments,
21
- // constraints become constants. So the OpenAPI message claims only what is true:
22
- // weaker documentation, never that the bundle cannot be used.
19
+ // OpenAPI: the TranscriberJ sends a request body's named example, or values from
20
+ // the schemas' own examples, in the contract cases it generates; without them it
21
+ // generates values from the constraints, and processes the bundle perfectly well.
22
+ // A response's example is read by nothing downstream. So the OpenAPI message
23
+ // claims only what is true for its part -- generated values for a request body,
24
+ // weaker documentation for both -- never that the bundle cannot be used.
23
25
 
24
26
  const KEY = "x-fragment-path";
25
27
 
@@ -160,8 +162,12 @@ function asyncapiMessage(finding) {
160
162
  */
161
163
  function openapiMessage(finding) {
162
164
  const where = finding.fragmentPath || `at ${finding.at}`;
163
- return `OpenAPI operation '${finding.operationId}': ${finding.part} (${where}) ` +
164
- "carries no example, which makes the generated documentation harder to read.";
165
+ const prefix = `OpenAPI operation '${finding.operationId}': ${finding.part} (${where}) carries no example, `;
166
+ if (finding.part === "request body") {
167
+ return prefix + "so the TranscriberJ's contract cases send generated values rather than ones the " +
168
+ "contract chose, and the generated documentation is harder to read.";
169
+ }
170
+ return prefix + "which makes the generated documentation harder to read.";
165
171
  }
166
172
 
167
173
  module.exports = {