Draft
Conversation
added 22 commits
May 18, 2022 13:23
… json object created
…chemas for visitors
…chemas for visitors
added 6 commits
May 24, 2022 13:28
…an one valid - will be chosen one with unique fields contained refactored some method of visitors, moved to abstract realization removed objectSchema from composed choice, objects can be as Schema<*> as valid one
cordwelt
suggested changes
May 26, 2022
src/main/kotlin/com/exactpro/th2/codec/openapi/utils/CommonUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/utils/OpenApiUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/utils/OpenApiUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/utils/OpenApiUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/writer/SchemaWriter.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/writer/visitors/json/EncodeJsonObjectVisitor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/writer/visitors/json/EncodeJsonObjectVisitor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/writer/visitors/json/DecodeJsonObjectVisitor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/writer/visitors/json/DecodeJsonObjectVisitor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/exactpro/th2/codec/openapi/writer/visitors/json/DecodeJsonObjectVisitor.kt
Outdated
Show resolved
Hide resolved
cordwelt
suggested changes
May 27, 2022
| }) | ||
| this.putProperties(METHOD_FIELD, container.method) | ||
| } | ||
| else -> error("Wrong type of Http Route Container") |
There was a problem hiding this comment.
You won't need it if you'll make HttpRouteContainer a sealed class
| is ResponseContainer -> this.putProperties(CODE_FIELD, container.code) | ||
| is RequestContainer -> { | ||
| this.putProperties(URI_FIELD, if (container.params.isNotEmpty()) { | ||
| container.uriPattern.resolve(container.params, message.getMessage(URI_PARAMS_FIELD).orEmpty().fieldsMap.mapValues { it.value.simpleValue }) |
There was a problem hiding this comment.
message.getMessage(URI_PARAMS_FIELD).orEmpty().fieldsMap.mapValues { it.value.simpleValue }
Extract into utility function?
Comment on lines
+340
to
+345
| headerMessage[name]?.let { header -> | ||
| headers.add(message().apply { | ||
| addField("name", name) | ||
| addField("value", header.simpleValue) | ||
| }) | ||
| } ?: run { if (value.required) error("Header param [$name] is required for ${message.messageType} message") } |
There was a problem hiding this comment.
Suggested change
| headerMessage[name]?.let { header -> | |
| headers.add(message().apply { | |
| addField("name", name) | |
| addField("value", header.simpleValue) | |
| }) | |
| } ?: run { if (value.required) error("Header param [$name] is required for ${message.messageType} message") } | |
| headerMessage[name]?.let { header -> | |
| headers += message().apply { | |
| this["name"] = name | |
| this["value"] = header.simpleValue | |
| } | |
| } ?: check(!value.required) { | |
| "Header param [$name] is required for ${message.messageType} message" | |
| } |
cordwelt
suggested changes
May 27, 2022
Comment on lines
+71
to
+72
| getFieldNames() | ||
| schemas.find { schema -> |
There was a problem hiding this comment.
Suggested change
| getFieldNames() | |
| schemas.find { schema -> | |
| getFieldNames().schemas.find { schema -> |
| SchemaWriter(settings.openAPI).traverse(visitor, itemSchema, throwUndefined) | ||
| visitor.rootMessage.build().run(this::add) | ||
| } | ||
| else -> rootMessage[fieldName] = arrayNode.map { |
There was a problem hiding this comment.
Suggested change
| else -> rootMessage[fieldName] = arrayNode.map { | |
| else -> rootMessage[fieldName] = arrayNode.asSequence().map { |
| visitor.rootMessage | ||
| } | ||
| }) | ||
| } |
added 2 commits
May 27, 2022 15:23
OptimumCode
reviewed
May 30, 2022
| is PasswordSchema, is EmailSchema, is BinarySchema, is ByteArraySchema, is FileSchema, is MapSchema, is UUIDSchema -> throw UnsupportedOperationException("${property::class.simpleName} isn't supported for now") | ||
| else -> visitor.visit(name, property, msgStructure.requiredContains(name), checkForUndefinedFields) | ||
| } | ||
| } ?: error("Schema ${it.name}:${it.type} have no properties to process") |
There was a problem hiding this comment.
I think we should validate schema during start up if it is not valid state for schema. But if it is a valid state we should not throw an exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.