Skip to content

Commit efa3dc5

Browse files
committed
v32: new properties
1 parent c84e524 commit efa3dc5

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

openapi-parser/src/main/java/io/openapiparser/Keywords.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public interface Keywords {
2424
String CONTAINS = "contains";
2525
String CONTENT = "content";
2626
String CONTENT_TYPE = "contentType";
27+
String DATA_VALUE = "dataValue";
2728
String DEFAULT = "default";
2829
String DELETE = "delete";
2930
String DEPENDENT_REQUIRED = "dependentRequired";
@@ -99,6 +100,7 @@ public interface Keywords {
99100
String SECURITY = "security";
100101
String SECURITY_SCHEMES = "securitySchemes";
101102
String SELF = "$self";
103+
String SERIALIZED_VALUE = "serializedValue";
102104
String SERVERS = "servers";
103105
String STYLE = "style";
104106
String SUMMARY = "summary";

openapi-parser/src/main/java/io/openapiparser/model/v32/Example.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,22 @@ public String getRef () {
4848
return getStringOrNull (DESCRIPTION);
4949
}
5050

51-
public @Nullable Object getValue () {
52-
return getRawValue (VALUE);
51+
public @Nullable Object getDataValue () {
52+
return getRawValue (DATA_VALUE);
53+
}
54+
55+
public @Nullable String getSerializedValue () {
56+
return getStringOrNull (SERIALIZED_VALUE);
5357
}
5458

5559
public @Nullable String getExternalValue () {
5660
return getStringOrNull (EXTERNAL_VALUE);
5761
}
5862

63+
public @Nullable Object getValue () {
64+
return getRawValue (VALUE);
65+
}
66+
5967
@Override
6068
public Map<String, @Nullable Object> getExtensions () {
6169
return super.getExtensions ();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2025 https://github.com/openapi-processor/openapi-parser
3+
* PDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.openapiparser.model.v32
7+
8+
import io.kotest.core.spec.style.StringSpec
9+
import io.kotest.matchers.nulls.shouldBeNull
10+
import io.kotest.matchers.nulls.shouldNotBeNull
11+
import io.kotest.matchers.shouldBe
12+
13+
class ExampleSpec: StringSpec({
14+
15+
"gets example data value" {
16+
example("dataValue: {}").dataValue.shouldNotBeNull()
17+
}
18+
19+
"gets example data value is null if missing" {
20+
example().dataValue.shouldBeNull()
21+
}
22+
23+
"gets example serialized value" {
24+
example("serializedValue: url").serializedValue shouldBe "url"
25+
}
26+
27+
"gets example serialized value is null if missing" {
28+
example().serializedValue.shouldBeNull()
29+
}
30+
})

0 commit comments

Comments
 (0)