Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-04-04 17:50:42.777972",
"spec_repo_commit": "9a7b22d0"
"regenerated": "2023-04-05 14:45:40.505110",
"spec_repo_commit": "627d5fdd"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-04-04 17:50:42.790852",
"spec_repo_commit": "9a7b22d0"
"regenerated": "2023-04-05 14:45:40.518187",
"spec_repo_commit": "627d5fdd"
}
}
}
52 changes: 52 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12425,6 +12425,7 @@ components:
oneOf:
- $ref: '#/components/schemas/ServiceDefinitionV2Email'
- $ref: '#/components/schemas/ServiceDefinitionV2Slack'
- $ref: '#/components/schemas/ServiceDefinitionV2MSTeams'
ServiceDefinitionV2Doc:
description: Service documents.
properties:
Expand Down Expand Up @@ -12511,6 +12512,7 @@ components:
oneOf:
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1Email'
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1Slack'
- $ref: '#/components/schemas/ServiceDefinitionV2Dot1MSTeams'
ServiceDefinitionV2Dot1Email:
description: Service owner's email.
properties:
Expand Down Expand Up @@ -12583,6 +12585,31 @@ components:
- RUNBOOK
- DASHBOARD
- OTHER
ServiceDefinitionV2Dot1MSTeams:
description: Service owner's Microsoft Teams.
properties:
contact:
description: Contact value.
example: https://teams.microsoft.com/myteam
type: string
name:
description: Contact Microsoft Teams.
example: My team channel
type: string
type:
$ref: '#/components/schemas/ServiceDefinitionV2Dot1MSTeamsType'
required:
- type
- contact
type: object
ServiceDefinitionV2Dot1MSTeamsType:
description: Contact type.
enum:
- microsoft-teams
example: microsoft-teams
type: string
x-enum-varnames:
- MICROSOFT_TEAMS
ServiceDefinitionV2Dot1Opsgenie:
description: Opsgenie integration for the service.
properties:
Expand Down Expand Up @@ -12723,6 +12750,31 @@ components:
- ONCALL
- CODE
- LINK
ServiceDefinitionV2MSTeams:
description: Service owner's Microsoft Teams.
properties:
contact:
description: Contact value.
example: https://teams.microsoft.com/myteam
type: string
name:
description: Contact Microsoft Teams.
example: My team channel
type: string
type:
$ref: '#/components/schemas/ServiceDefinitionV2MSTeamsType'
required:
- type
- contact
type: object
ServiceDefinitionV2MSTeamsType:
description: Contact type.
enum:
- microsoft-teams
example: microsoft-teams
type: string
x-enum-varnames:
- MICROSOFT_TEAMS
ServiceDefinitionV2Opsgenie:
description: Opsgenie integration for the service.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,51 @@ public ServiceDefinitionV2Contact deserialize(JsonParser jp, DeserializationCont
log.log(Level.FINER, "Input data does not match schema 'ServiceDefinitionV2Slack'", e);
}

// deserialize ServiceDefinitionV2MSTeams
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (ServiceDefinitionV2MSTeams.class.equals(Integer.class)
|| ServiceDefinitionV2MSTeams.class.equals(Long.class)
|| ServiceDefinitionV2MSTeams.class.equals(Float.class)
|| ServiceDefinitionV2MSTeams.class.equals(Double.class)
|| ServiceDefinitionV2MSTeams.class.equals(Boolean.class)
|| ServiceDefinitionV2MSTeams.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((ServiceDefinitionV2MSTeams.class.equals(Integer.class)
|| ServiceDefinitionV2MSTeams.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((ServiceDefinitionV2MSTeams.class.equals(Float.class)
|| ServiceDefinitionV2MSTeams.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(ServiceDefinitionV2MSTeams.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(ServiceDefinitionV2MSTeams.class.equals(String.class)
&& token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(ServiceDefinitionV2MSTeams.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
if (!((ServiceDefinitionV2MSTeams) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'ServiceDefinitionV2MSTeams'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'ServiceDefinitionV2MSTeams'", e);
}

ServiceDefinitionV2Contact ret = new ServiceDefinitionV2Contact();
if (match == 1) {
ret.setActualInstance(deserialized);
Expand Down Expand Up @@ -209,9 +254,15 @@ public ServiceDefinitionV2Contact(ServiceDefinitionV2Slack o) {
setActualInstance(o);
}

public ServiceDefinitionV2Contact(ServiceDefinitionV2MSTeams o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

static {
schemas.put("ServiceDefinitionV2Email", new GenericType<ServiceDefinitionV2Email>() {});
schemas.put("ServiceDefinitionV2Slack", new GenericType<ServiceDefinitionV2Slack>() {});
schemas.put("ServiceDefinitionV2MSTeams", new GenericType<ServiceDefinitionV2MSTeams>() {});
JSON.registerDescendants(
ServiceDefinitionV2Contact.class, Collections.unmodifiableMap(schemas));
}
Expand All @@ -223,7 +274,8 @@ public Map<String, GenericType> getSchemas() {

/**
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: ServiceDefinitionV2Email, ServiceDefinitionV2Slack
* against the oneOf child schemas: ServiceDefinitionV2Email, ServiceDefinitionV2Slack,
* ServiceDefinitionV2MSTeams
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand All @@ -238,20 +290,26 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(ServiceDefinitionV2MSTeams.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException(
"Invalid instance type. Must be ServiceDefinitionV2Email, ServiceDefinitionV2Slack");
"Invalid instance type. Must be ServiceDefinitionV2Email, ServiceDefinitionV2Slack,"
+ " ServiceDefinitionV2MSTeams");
}

/**
* Get the actual instance, which can be the following: ServiceDefinitionV2Email,
* ServiceDefinitionV2Slack
* ServiceDefinitionV2Slack, ServiceDefinitionV2MSTeams
*
* @return The actual instance (ServiceDefinitionV2Email, ServiceDefinitionV2Slack)
* @return The actual instance (ServiceDefinitionV2Email, ServiceDefinitionV2Slack,
* ServiceDefinitionV2MSTeams)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -279,4 +337,15 @@ public ServiceDefinitionV2Email getServiceDefinitionV2Email() throws ClassCastEx
public ServiceDefinitionV2Slack getServiceDefinitionV2Slack() throws ClassCastException {
return (ServiceDefinitionV2Slack) super.getActualInstance();
}

/**
* Get the actual instance of `ServiceDefinitionV2MSTeams`. If the actual instance is not
* `ServiceDefinitionV2MSTeams`, the ClassCastException will be thrown.
*
* @return The actual instance of `ServiceDefinitionV2MSTeams`
* @throws ClassCastException if the instance is not `ServiceDefinitionV2MSTeams`
*/
public ServiceDefinitionV2MSTeams getServiceDefinitionV2MSTeams() throws ClassCastException {
return (ServiceDefinitionV2MSTeams) super.getActualInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,52 @@ public ServiceDefinitionV2Dot1Contact deserialize(JsonParser jp, Deserialization
log.log(Level.FINER, "Input data does not match schema 'ServiceDefinitionV2Dot1Slack'", e);
}

// deserialize ServiceDefinitionV2Dot1MSTeams
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (ServiceDefinitionV2Dot1MSTeams.class.equals(Integer.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(Long.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(Float.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(Double.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(Boolean.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((ServiceDefinitionV2Dot1MSTeams.class.equals(Integer.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((ServiceDefinitionV2Dot1MSTeams.class.equals(Float.class)
|| ServiceDefinitionV2Dot1MSTeams.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(ServiceDefinitionV2Dot1MSTeams.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(ServiceDefinitionV2Dot1MSTeams.class.equals(String.class)
&& token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(ServiceDefinitionV2Dot1MSTeams.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
if (!((ServiceDefinitionV2Dot1MSTeams) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'ServiceDefinitionV2Dot1MSTeams'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(
Level.FINER, "Input data does not match schema 'ServiceDefinitionV2Dot1MSTeams'", e);
}

ServiceDefinitionV2Dot1Contact ret = new ServiceDefinitionV2Dot1Contact();
if (match == 1) {
ret.setActualInstance(deserialized);
Expand Down Expand Up @@ -213,9 +259,16 @@ public ServiceDefinitionV2Dot1Contact(ServiceDefinitionV2Dot1Slack o) {
setActualInstance(o);
}

public ServiceDefinitionV2Dot1Contact(ServiceDefinitionV2Dot1MSTeams o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

static {
schemas.put("ServiceDefinitionV2Dot1Email", new GenericType<ServiceDefinitionV2Dot1Email>() {});
schemas.put("ServiceDefinitionV2Dot1Slack", new GenericType<ServiceDefinitionV2Dot1Slack>() {});
schemas.put(
"ServiceDefinitionV2Dot1MSTeams", new GenericType<ServiceDefinitionV2Dot1MSTeams>() {});
JSON.registerDescendants(
ServiceDefinitionV2Dot1Contact.class, Collections.unmodifiableMap(schemas));
}
Expand All @@ -227,7 +280,8 @@ public Map<String, GenericType> getSchemas() {

/**
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: ServiceDefinitionV2Dot1Email, ServiceDefinitionV2Dot1Slack
* against the oneOf child schemas: ServiceDefinitionV2Dot1Email, ServiceDefinitionV2Dot1Slack,
* ServiceDefinitionV2Dot1MSTeams
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand All @@ -242,21 +296,27 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(
ServiceDefinitionV2Dot1MSTeams.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException(
"Invalid instance type. Must be ServiceDefinitionV2Dot1Email,"
+ " ServiceDefinitionV2Dot1Slack");
"Invalid instance type. Must be ServiceDefinitionV2Dot1Email, ServiceDefinitionV2Dot1Slack,"
+ " ServiceDefinitionV2Dot1MSTeams");
}

/**
* Get the actual instance, which can be the following: ServiceDefinitionV2Dot1Email,
* ServiceDefinitionV2Dot1Slack
* ServiceDefinitionV2Dot1Slack, ServiceDefinitionV2Dot1MSTeams
*
* @return The actual instance (ServiceDefinitionV2Dot1Email, ServiceDefinitionV2Dot1Slack)
* @return The actual instance (ServiceDefinitionV2Dot1Email, ServiceDefinitionV2Dot1Slack,
* ServiceDefinitionV2Dot1MSTeams)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -284,4 +344,16 @@ public ServiceDefinitionV2Dot1Email getServiceDefinitionV2Dot1Email() throws Cla
public ServiceDefinitionV2Dot1Slack getServiceDefinitionV2Dot1Slack() throws ClassCastException {
return (ServiceDefinitionV2Dot1Slack) super.getActualInstance();
}

/**
* Get the actual instance of `ServiceDefinitionV2Dot1MSTeams`. If the actual instance is not
* `ServiceDefinitionV2Dot1MSTeams`, the ClassCastException will be thrown.
*
* @return The actual instance of `ServiceDefinitionV2Dot1MSTeams`
* @throws ClassCastException if the instance is not `ServiceDefinitionV2Dot1MSTeams`
*/
public ServiceDefinitionV2Dot1MSTeams getServiceDefinitionV2Dot1MSTeams()
throws ClassCastException {
return (ServiceDefinitionV2Dot1MSTeams) super.getActualInstance();
}
}
Loading