Skip to content

Commit

Permalink
fix(specs): ignorePlurals can be a boolean string (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3620

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Aug 30, 2024
1 parent 629edea commit d114bf4
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

package com.algolia.model.recommend;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;

/** Gets or Sets booleanString */
@JsonDeserialize(as = BooleanString.class)
public enum BooleanString implements IgnorePlurals {
TRUE("true"),

FALSE("false");

private final String value;

BooleanString(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static BooleanString fromValue(String value) {
for (BooleanString b : BooleanString.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ public IgnorePlurals deserialize(JsonParser jp, DeserializationContext ctxt) thr
);
}
}
// deserialize BooleanString
if (tree.isTextual()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(BooleanString.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf BooleanString (error: " + e.getMessage() + ") (type: BooleanString)");
}
}
// deserialize Boolean
if (tree.isBoolean()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

package com.algolia.model.search;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;

/** Gets or Sets booleanString */
@JsonDeserialize(as = BooleanString.class)
public enum BooleanString implements IgnorePlurals {
TRUE("true"),

FALSE("false");

private final String value;

BooleanString(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static BooleanString fromValue(String value) {
for (BooleanString b : BooleanString.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ public IgnorePlurals deserialize(JsonParser jp, DeserializationContext ctxt) thr
);
}
}
// deserialize BooleanString
if (tree.isTextual()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(BooleanString.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf BooleanString (error: " + e.getMessage() + ") (type: BooleanString)");
}
}
// deserialize Boolean
if (tree.isBoolean()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
Expand Down

0 comments on commit d114bf4

Please sign in to comment.