Add description to POST requests 67/107467/8
authorlubos-cicut <lubos.cicut@pantheon.tech>
Tue, 22 Aug 2023 05:32:19 +0000 (07:32 +0200)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Wed, 13 Sep 2023 06:47:21 +0000 (06:47 +0000)
Add description to POST request (paths/…/post/description)
that states that user in example payload sees only the first
data node child of the resource to be created and that
this is in accordance with RFC 8040 which allows us to
create only one resource in POST request.

JIRA: NETCONF-1137
Change-Id: I8549cf860deb5e069a017c9e7247c0bce311e588
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/builder/OperationBuilder.java

index 5d6a620024249ca466f8a5a189ca346da9655143..ddde629e33b051c2d26b6adcefcbf75a9c8e5603 100644 (file)
@@ -46,6 +46,12 @@ public final class OperationBuilder {
     private static final List<String> MIME_TYPES = List.of(MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON);
     private static final String OBJECT = "object";
     private static final String TYPE_KEY = "type";
+    private static final String POST_DESCRIPTION = """
+        \n
+        Note:
+        In example payload, you can see only the first data node child of the resource to be created, following the
+        guidelines of RFC 8040, which allows us to create only one resource in POST request.
+        """;
 
     private OperationBuilder() {
         // Hidden on purpose
@@ -78,7 +84,7 @@ public final class OperationBuilder {
             .parameters(parameters)
             .requestBody(requestBody)
             .responses(responses)
-            .description(description)
+            .description(description + POST_DESCRIPTION)
             .summary(summary)
             .build();
     }