Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number Validator improvement to support OpenAPI & AsyncAPI specs #875

Merged
merged 8 commits into from
Apr 5, 2024

Conversation

ankitk-me
Copy link
Contributor

No description provided.

Comment on lines 26 to 29
max: 1234.23
min: -1234.94
exclusiveMax: true
exclusiveMin: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
max: 1234.23
min: -1234.94
exclusiveMax: true
exclusiveMin: true
range: (-1234.94,1234.23)

Do you think using range with standard [ (inclusive) vs ( (exclusive) would be easier to read than 4 separate properties?

Comment on lines 2 to 9
{
"op": "add",
"path": "/$defs/types/enum/-",
"value": "double"
},
{
"op": "add",
"path": "/$defs/converter/oneOf/1/allOf/-",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's review the structure of the schema for converters and validators, this doesn't look quite right to me.

Also we need to register for both converters and validators enums, agree?

{
"type": "boolean",
"default": false
"type": "string"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a pattern for the string to validate syntax of the range format, agree?

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class RangeConfigAdapter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config adapter design pattern instantiates the adapter, and then calls adaptToJson and adaptFromJson as needed.

Let's follow the same pattern here, using adaptToString and adaptFromString instead.

io.aklivity.zilla.runtime.model.core.internal.config.StringModelConfigAdapter;

provides io.aklivity.zilla.runtime.engine.model.ModelFactorySpi
with io.aklivity.zilla.runtime.model.core.internal.Int32ModelFactorySpi,
io.aklivity.zilla.runtime.model.core.internal.Int64ModelFactorySpi,
io.aklivity.zilla.runtime.model.core.internal.FloatModelFactorySpi,
io.aklivity.zilla.runtime.model.core.internal.DoubleModelFactorySpi,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please list these provider implementations in alphabetical order.

@@ -22,12 +22,14 @@
with io.aklivity.zilla.runtime.model.core.internal.config.Int32ModelConfigAdapter,
io.aklivity.zilla.runtime.model.core.internal.config.Int64ModelConfigAdapter,
io.aklivity.zilla.runtime.model.core.internal.config.FloatModelConfigAdapter,
io.aklivity.zilla.runtime.model.core.internal.config.DoubleModelConfigAdapter,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please list these provider implementations in alphabetical order.

@@ -1,4 +1,5 @@
io.aklivity.zilla.runtime.model.core.internal.config.Int32ModelConfigAdapter
io.aklivity.zilla.runtime.model.core.internal.config.Int64ModelConfigAdapter
io.aklivity.zilla.runtime.model.core.internal.config.FloatModelConfigAdapter
io.aklivity.zilla.runtime.model.core.internal.config.DoubleModelConfigAdapter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please list these provider implementations in alphabetical order.

@@ -1,4 +1,5 @@
io.aklivity.zilla.runtime.model.core.internal.Int32ModelFactorySpi
io.aklivity.zilla.runtime.model.core.internal.Int64ModelFactorySpi
io.aklivity.zilla.runtime.model.core.internal.FloatModelFactorySpi
io.aklivity.zilla.runtime.model.core.internal.DoubleModelFactorySpi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please list these provider implementations in alphabetical order.

@ankitk-me ankitk-me marked this pull request as ready for review April 5, 2024 10:44
@jfallows jfallows merged commit 0a72052 into aklivity:develop Apr 5, 2024
5 checks passed
@jfallows jfallows linked an issue Apr 5, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support OpenAPI and AsyncAPI validation cases
2 participants