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
2 changes: 1 addition & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54852,7 +54852,7 @@ components:
description: An array of related resources, returned when the `include` query parameter is used.
oneOf:
- $ref: "#/components/schemas/Issue"
- $ref: "#/components/schemas/Case"
- $ref: "#/components/schemas/IssueCase"
- $ref: "#/components/schemas/IssueUser"
- $ref: "#/components/schemas/IssueTeam"
IssuesSearchResultIssueRelationship:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,45 +121,46 @@ public IssuesSearchResultIncluded deserialize(JsonParser jp, DeserializationCont
log.log(Level.FINER, "Input data does not match schema 'Issue'", e);
}

// deserialize Case
// deserialize IssueCase
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (Case.class.equals(Integer.class)
|| Case.class.equals(Long.class)
|| Case.class.equals(Float.class)
|| Case.class.equals(Double.class)
|| Case.class.equals(Boolean.class)
|| Case.class.equals(String.class)) {
if (IssueCase.class.equals(Integer.class)
|| IssueCase.class.equals(Long.class)
|| IssueCase.class.equals(Float.class)
|| IssueCase.class.equals(Double.class)
|| IssueCase.class.equals(Boolean.class)
|| IssueCase.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((Case.class.equals(Integer.class) || Case.class.equals(Long.class))
((IssueCase.class.equals(Integer.class) || IssueCase.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((Case.class.equals(Float.class) || Case.class.equals(Double.class))
((IssueCase.class.equals(Float.class) || IssueCase.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(Case.class.equals(Boolean.class)
(IssueCase.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |= (Case.class.equals(String.class) && token == JsonToken.VALUE_STRING);
attemptParsing |=
(IssueCase.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(Case.class);
tmp = tree.traverse(jp.getCodec()).readValueAs(IssueCase.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 (!((Case) tmp).unparsed) {
if (!((IssueCase) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'Case'");
log.log(Level.FINER, "Input data matches schema 'IssueCase'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'Case'", e);
log.log(Level.FINER, "Input data does not match schema 'IssueCase'", e);
}

// deserialize IssueUser
Expand Down Expand Up @@ -280,7 +281,7 @@ public IssuesSearchResultIncluded(Issue o) {
setActualInstance(o);
}

public IssuesSearchResultIncluded(Case o) {
public IssuesSearchResultIncluded(IssueCase o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}
Expand All @@ -297,7 +298,7 @@ public IssuesSearchResultIncluded(IssueTeam o) {

static {
schemas.put("Issue", new GenericType<Issue>() {});
schemas.put("Case", new GenericType<Case>() {});
schemas.put("IssueCase", new GenericType<IssueCase>() {});
schemas.put("IssueUser", new GenericType<IssueUser>() {});
schemas.put("IssueTeam", new GenericType<IssueTeam>() {});
JSON.registerDescendants(
Expand All @@ -311,7 +312,7 @@ 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: Issue, Case, IssueUser, IssueTeam
* against the oneOf child schemas: Issue, IssueCase, IssueUser, IssueTeam
*
* <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 @@ -322,7 +323,7 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(Case.class, instance, new HashSet<Class<?>>())) {
if (JSON.isInstanceOf(IssueCase.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
Expand All @@ -339,13 +340,14 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException("Invalid instance type. Must be Issue, Case, IssueUser, IssueTeam");
throw new RuntimeException(
"Invalid instance type. Must be Issue, IssueCase, IssueUser, IssueTeam");
}

/**
* Get the actual instance, which can be the following: Issue, Case, IssueUser, IssueTeam
* Get the actual instance, which can be the following: Issue, IssueCase, IssueUser, IssueTeam
*
* @return The actual instance (Issue, Case, IssueUser, IssueTeam)
* @return The actual instance (Issue, IssueCase, IssueUser, IssueTeam)
*/
@Override
public Object getActualInstance() {
Expand All @@ -364,14 +366,14 @@ public Issue getIssue() throws ClassCastException {
}

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

/**
Expand Down
Loading