Skip to content

Commit

Permalink
test(2.6.0): check correctness of realisation by reading AsyncAPI exa…
Browse files Browse the repository at this point in the history
…mple - Not Example

asyncapi#165
  • Loading branch information
Pakisan committed Feb 25, 2024
1 parent 143ea24 commit 67cb954
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
59 changes: 59 additions & 0 deletions asyncapi-core/src/test/kotlin/com/asyncapi/examples/v2/_6_0/Not.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.asyncapi.examples.v2._6_0

import com.asyncapi.v2.Reference
import com.asyncapi.v2._6_0.model.channel.ChannelItem
import com.asyncapi.v2._6_0.model.channel.message.Message
import com.asyncapi.v2._6_0.model.channel.operation.Operation
import com.asyncapi.v2._6_0.model.component.Components
import com.asyncapi.v2._6_0.model.info.Info
import com.asyncapi.v2.schema.Schema

class Not: AbstractExampleValidationTest() {

override fun specificationLocation(): String = "/examples/v2.6.0/not.yml"

override fun expectedInfo(): Info {
return Info.builder()
.title("Not example")
.version("1.0.0")
.build()
}

override fun expectedServers(): Map<String, Any>? = null

override fun expectedChannels(): Map<String, Any> {
return mapOf(
Pair("test", ChannelItem.builder()
.publish(Operation.builder()
.message(Reference("#/components/messages/testMessages"))
.build()
)
.build()
)
)
}

override fun expectedComponents(): Components? {
return Components.builder()
.messages(mapOf(
Pair("testMessages", Message.builder()
.payload(Schema.builder().ref("#/components/schemas/testSchema").build())
.build()
)
))
.schemas(mapOf(
Pair("testSchema", Schema.builder()
.type("object")
.properties(mapOf(
Pair("key", Schema.builder()
.not(Schema.builder().type("integer").build())
.build()
)
))
.build()
)
))
.build()
}

}
24 changes: 24 additions & 0 deletions asyncapi-core/src/test/resources/examples/v2.6.0/not.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
asyncapi: "2.6.0"
info:
title: Not example
version: '1.0.0'

channels:
test:
publish:
message:
$ref: '#/components/messages/testMessages'

components:
messages:
testMessages:
payload:
$ref: "#/components/schemas/testSchema"

schemas:
testSchema:
type: object
properties:
key:
not:
type: integer

0 comments on commit 67cb954

Please sign in to comment.