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

chore: 1.0.0-eap-1 master #35

Merged
merged 30 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
992d3d2
[asyncapi-idea-plugin]: IDEA from 2020.1.* to 2020.3.*
Pakisan Dec 31, 2020
9e73b4e
[asyncapi-idea-plugin]: change notes
Pakisan Jan 7, 2021
1be92f3
[asyncapi-idea-plugin]: 1.0.0-EAP-1
Pakisan Jan 7, 2021
232d32f
Project Information
Pakisan Jan 7, 2021
47e7308
scm information
Pakisan Jan 16, 2021
719bb2b
packaging of sources and javadocs on build
Pakisan Jan 16, 2021
2500f4f
publishing configuration
Pakisan Jan 16, 2021
0c85168
publishing configuration
Pakisan Jan 16, 2021
adba3d9
1.0.0-EAP
Pakisan Jan 16, 2021
3c96fff
1.0.0-EAP
Pakisan Jan 25, 2021
8f8a226
README.md
Pakisan Jan 25, 2021
be1a84e
README.md
Pakisan Jan 28, 2021
5d07b98
README.md
Pakisan Jan 30, 2021
388a55a
Merge branch 'develop' into 1.0.0-EAP
Pakisan Jan 30, 2021
b52b2e6
README.md - release section
Pakisan Jan 30, 2021
68a2c40
[asyncapi-gradle-plugin]: switching to asyncapi-core:1.0.0-EAP versio…
Pakisan Jan 30, 2021
efb2c19
[asyncapi-gradle-plugin]: gradle-6.8.1
Pakisan Jan 30, 2021
a1db327
[asyncapi-gradle-plugin]: 1.0.0-EAP with release configuration and re…
Pakisan Jan 30, 2021
d028725
docs: new README.md (#28)
Pakisan Feb 1, 2021
2636564
[asyncapi-core]: Schema updation
Pakisan Feb 2, 2021
57179ee
1.0.0-EAP
Pakisan Feb 4, 2021
cc9bd07
1.0.0-EAP (#29)
Pakisan Feb 5, 2021
539361a
Merge branch 'feat!/Schema_updation' into 1.0.0-EAP-1
Pakisan Mar 8, 2021
cb6d8ac
docs: Corrected description for Message.examples
Pakisan Mar 8, 2021
c20edc9
docs: Schema javadoc fix.
Pakisan Mar 8, 2021
2ec2204
fix: fixed asyncapi-gradle-plugin tests after merging of 26365645e095…
Pakisan Mar 8, 2021
819de9f
chore: Jackson updated from 2.10.3 to 2.12.1
Pakisan Mar 8, 2021
9062cf1
1.0.0-EAP-1
Pakisan Mar 8, 2021
7303ce1
Merge branch 'develop' into 1.0.0-EAP-1
Pakisan Mar 8, 2021
6c89b85
Merge branch 'master' into 1.0.0-EAP-1
Pakisan Mar 8, 2021
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 asyncapi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>asyncapi</artifactId>
<groupId>com.asyncapi</groupId>
<version>1.0.0-EAP</version>
<version>1.0.0-EAP-1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ public class Message {
private Map<String, ? extends MessageBinding> bindings;

/**
* An array with examples of valid message objects.
* An array of key/value pairs where keys MUST be either <b></b>headers</b> and/or <b>payload</b>.
* <br>
* Values MUST contain examples
* that validate against the {@link #headers} or {@link #payload} fields, respectively.
*/
@CheckForNull
private List<Map<String, Object>> examples;
Expand Down
598 changes: 435 additions & 163 deletions asyncapi-core/src/main/java/com/asyncapi/v2/model/schema/Schema.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
package com.asyncapi.v2.model.schema;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* @author Pavel Bodiachevskii
*/
public enum Type {
public class Type {

@JsonProperty("null")
NULL,
@JsonProperty("boolean")
BOOLEAN,
@JsonProperty("object")
OBJECT,
@JsonProperty("array")
ARRAY,
@JsonProperty("number")
NUMBER,
@JsonProperty("string")
STRING,
@JsonProperty("integer")
INTEGER
public final static String NULL = "null";
public final static String BOOLEAN = "boolean";
public final static String OBJECT = "object";
public final static String ARRAY = "array";
public final static String NUMBER = "number";
public final static String STRING = "string";
public final static String INTEGER = "integer";

}
4 changes: 2 additions & 2 deletions asyncapi-plugin/asyncapi-plugin-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>asyncapi-plugin</artifactId>
<groupId>com.asyncapi</groupId>
<version>1.0.0-EAP</version>
<version>1.0.0-EAP-1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>com.asyncapi</groupId>
<artifactId>asyncapi-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0-EAP-1</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion asyncapi-plugin/asyncapi-plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Lamps(asyncapi: String = "2.0.0",
Pair("port", ServerVariable.builder()
.description("Secure connection (TLS) is available through port 8883.")
.defaultValue("1883")
.enumValues(listOf("1883", "8883"))
.enumValue(listOf("1883", "8883"))
.build()
)
))
Expand Down
4 changes: 2 additions & 2 deletions asyncapi-plugin/asyncapi-plugin-gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repositories {
}

group = "com.asyncapi"
version = "1.0.0-EAP"
version = "1.0.0-EAP-1"

dependencies {
val reflectionsVersion = "0.9.12"
Expand All @@ -27,7 +27,7 @@ dependencies {
compile("com.fasterxml.jackson.core:jackson-core:$jacksonVersion")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion")

compile("com.asyncapi:asyncapi-plugin-core:1.0.0-SNAPSHOT")
compile("com.asyncapi:asyncapi-plugin-core:1.0.0-EAP-1")

testCompile("org.jetbrains.kotlin:kotlin-test:1.3.71")
testCompile("org.junit.jupiter:junit-jupiter-engine:5.6.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ sourceSets {
}

dependencies {
compile "com.asyncapi:asyncapi-core:1.0.0-EAP"
compile "com.asyncapi:asyncapi-core:1.0.0-EAP-1"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"asyncapi":"2.0.0","defaultContentType":"application/json","info":{"title":"Lamps API","version":"1.0.0","description":"Recive real-time information about lamps","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0"}},"servers":{"production":{"url":"api.streetlights.smartylighting.com:{port}","protocol":"mqtt","description":"Test broker","variables":{"port":{"description":"Secure connection (TLS) is available through port 8883.","enum":["1883","8883"],"default":"1883"}},"security":[{"apiKey":[]},{"supportedOauthFlows":["streetlights:on","streetlights:off","streetlights:dim"]},{"openIdConnectWellKnown":[]}]}},"channels":{"smartylighting/lamps/1/0/event/{lampId}/info":{"description":"The topic on which lamp info may be produced and consumed.","subscribe":{"operationId":"receiveLampInfo","summary":"Receive information about lamp.","traits":[{"$ref":"#/components/operationTraits/kafka"}],"message":{"$ref":"#/components/messages/lampInfo"}},"parameters":{"lampId":{"$ref":"#/components/parameters/lampId"}}}},"components":{"schemas":{"lampInfoPayload":{"type":"object","properties":{"lumens":{"type":"integer","minimum":0,"description":"Lamp intensity measured in lumens."},"watts":{"type":"integer","maximum":100,"minimum":0,"description":"Lamp watt consumption."}}}},"messages":{"lampInfo":{"payload":{"$ref":"#/components/schemas/lampInfoPayload"},"contentType":"application/json","name":"lampInfo","title":"Lamp info","summary":"Lamp information.","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}]}},"securitySchemes":{"apiKey":{"type":"apiKey","description":"Provide your API key as the user and leave the password empty.","in":"user"}},"parameters":{"lampId":{"description":"The ID of the lamp.","schema":{"type":"string"}}},"operationTraits":{"kafka":{"bindings":{"kafka":{"clientId":"my-app-id"}}}},"messageTraits":{"commonHeaders":{"headers":{"type":"object","properties":{"my-app-header":{"type":"integer","maximum":100,"minimum":0}}}}}}}
{"asyncapi":"2.0.0","defaultContentType":"application/json","info":{"title":"Lamps API","version":"1.0.0","description":"Recive real-time information about lamps","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0"}},"servers":{"production":{"url":"api.streetlights.smartylighting.com:{port}","protocol":"mqtt","description":"Test broker","variables":{"port":{"description":"Secure connection (TLS) is available through port 8883.","enum":["1883","8883"],"default":"1883"}},"security":[{"apiKey":[]},{"supportedOauthFlows":["streetlights:on","streetlights:off","streetlights:dim"]},{"openIdConnectWellKnown":[]}]}},"channels":{"smartylighting/lamps/1/0/event/{lampId}/info":{"description":"The topic on which lamp info may be produced and consumed.","subscribe":{"operationId":"receiveLampInfo","summary":"Receive information about lamp.","traits":[{"$ref":"#/components/operationTraits/kafka"}],"message":{"$ref":"#/components/messages/lampInfo"}},"parameters":{"lampId":{"$ref":"#/components/parameters/lampId"}}}},"components":{"schemas":{"lampInfoPayload":{"type":"object","properties":{"lumens":{"description":"Lamp intensity measured in lumens.","type":"integer","minimum":0},"watts":{"description":"Lamp watt consumption.","type":"integer","maximum":100,"minimum":0}}}},"messages":{"lampInfo":{"payload":{"$ref":"#/components/schemas/lampInfoPayload"},"contentType":"application/json","name":"lampInfo","title":"Lamp info","summary":"Lamp information.","traits":[{"$ref":"#/components/messageTraits/commonHeaders"}]}},"securitySchemes":{"apiKey":{"type":"apiKey","description":"Provide your API key as the user and leave the password empty.","in":"user"}},"parameters":{"lampId":{"description":"The ID of the lamp.","schema":{"type":"string"}}},"operationTraits":{"kafka":{"bindings":{"kafka":{"clientId":"my-app-id"}}}},"messageTraits":{"commonHeaders":{"headers":{"type":"object","properties":{"my-app-header":{"type":"integer","maximum":100,"minimum":0}}}}}}}
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ components:
type: "object"
properties:
lumens:
description: "Lamp intensity measured in lumens."
type: "integer"
minimum: 0
description: "Lamp intensity measured in lumens."
watts:
description: "Lamp watt consumption."
type: "integer"
maximum: 100
minimum: 0
description: "Lamp watt consumption."
messages:
lampInfo:
payload:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
"type" : "object",
"properties" : {
"lumens" : {
"description" : "Lamp intensity measured in lumens.",
"type" : "integer",
"minimum" : 0,
"description" : "Lamp intensity measured in lumens."
"minimum" : 0
},
"watts" : {
"description" : "Lamp watt consumption.",
"type" : "integer",
"maximum" : 100,
"minimum" : 0,
"description" : "Lamp watt consumption."
"minimum" : 0
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion asyncapi-plugin/asyncapi-plugin-maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class StreetlightsAsyncAPI extends AsyncAPI {
serverVariables.put("port", ServerVariable.builder()
.description("Secure connection (TLS) is available through port 8883.")
.defaultValue("1883")
.enumValues(Arrays.asList("1883", "8883"))
.enumValue(Arrays.asList("1883", "8883"))
.build()
);

Expand Down
4 changes: 2 additions & 2 deletions asyncapi-plugin/asyncapi-plugin-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>asyncapi-plugin</artifactId>
<groupId>com.asyncapi</groupId>
<version>1.0.0-EAP</version>
<version>1.0.0-EAP-1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -92,7 +92,7 @@
<dependency>
<groupId>com.asyncapi</groupId>
<artifactId>asyncapi-plugin-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0-EAP-1</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import java.io.File;
import java.io.FileReader;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author Pavel Bodiachevskii
Expand Down Expand Up @@ -51,7 +54,7 @@ public Object[] singleSchemaGenerationParams() {
public void singleSchemaGenerationTest(File pom, File generatedSchema, File expectedSchema) throws Exception {
executePom(pom);

Assert.assertEquals(FileUtils.readLines(expectedSchema), FileUtils.readLines(generatedSchema));
Assert.assertEquals(format(FileUtils.readLines(expectedSchema)), format(FileUtils.readLines(generatedSchema)));
}

public Object[] multipleSchemaGenerationParams() {
Expand Down Expand Up @@ -92,8 +95,8 @@ public void multipleSchemasGenerationTest(File pom,
) throws Exception {
executePom(pom);

Assert.assertEquals(FileUtils.readLines(expectedSchemaFirst), FileUtils.readLines(generatedSchemaFirst));
Assert.assertEquals(FileUtils.readLines(expectedSchemaSecond), FileUtils.readLines(generatedSchemaSecond));
Assert.assertEquals(format(FileUtils.readLines(expectedSchemaFirst)), format(FileUtils.readLines(generatedSchemaFirst)));
Assert.assertEquals(format(FileUtils.readLines(expectedSchemaSecond)), format(FileUtils.readLines(generatedSchemaSecond)));
}

@Test
Expand All @@ -103,7 +106,7 @@ public void customFileNameGenerationTest() throws Exception {
File generatedSchema = FilesHelper.open("target/generated-test-sources/Complete/StreetlightsAsyncAPI-asyncapi-schema.json");
File expectedSchema = FilesHelper.readResource("reference-test-cases/json/StreetlightsAsyncAPI-asyncapi.json");

Assert.assertEquals(FileUtils.readLines(expectedSchema), FileUtils.readLines(generatedSchema));
Assert.assertEquals(format(FileUtils.readLines(expectedSchema)), format(FileUtils.readLines(generatedSchema)));
}

/**
Expand All @@ -125,4 +128,20 @@ private void executePom(File pomFile) throws Exception {
myMojo.execute();
}

private List<String> format(List<String> fileLines) {
return fileLines.stream()
.filter(Objects::nonNull)
.filter(line -> !line.isEmpty())
.map(line -> {
int index = line.lastIndexOf(",");
if (index > 0) {
return line.substring(0, index);
}

return line;
})
.sorted()
.collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import java.io.File;
import java.io.FileReader;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @author Pavel Bodiachevskii
Expand Down Expand Up @@ -51,7 +54,7 @@ public Object[] singleSchemaGenerationParams() {
public void singleSchemaGenerationTest(File pom, File generatedSchema, File expectedSchema) throws Exception {
executePom(pom);

Assert.assertEquals(FileUtils.readLines(expectedSchema), FileUtils.readLines(generatedSchema));
Assert.assertEquals(format(FileUtils.readLines(expectedSchema)), format(FileUtils.readLines(generatedSchema)));
}

public Object[] multipleSchemaGenerationParams() {
Expand Down Expand Up @@ -92,8 +95,8 @@ public void multipleSchemasGenerationTest(File pom,
) throws Exception {
executePom(pom);

Assert.assertEquals(FileUtils.readLines(expectedSchemaFirst), FileUtils.readLines(generatedSchemaFirst));
Assert.assertEquals(FileUtils.readLines(expectedSchemaSecond), FileUtils.readLines(generatedSchemaSecond));
Assert.assertEquals(format(FileUtils.readLines(expectedSchemaFirst)), format(FileUtils.readLines(generatedSchemaFirst)));
Assert.assertEquals(format(FileUtils.readLines(expectedSchemaSecond)), format(FileUtils.readLines(generatedSchemaSecond)));
}

@Test
Expand All @@ -103,7 +106,7 @@ public void customFileNameGenerationTest() throws Exception {
File generatedSchema = FilesHelper.open("target/generated-test-sources/Complete/StreetlightsAsyncAPI-asyncapi-schema.yaml");
File expectedSchema = FilesHelper.readResource("reference-test-cases/yaml/StreetlightsAsyncAPI-asyncapi.yaml");

Assert.assertEquals(FileUtils.readLines(expectedSchema), FileUtils.readLines(generatedSchema));
Assert.assertEquals(format(FileUtils.readLines(expectedSchema)), format(FileUtils.readLines(generatedSchema)));
}

/**
Expand All @@ -125,4 +128,20 @@ private void executePom(File pomFile) throws Exception {
myMojo.execute();
}

private List<String> format(List<String> fileLines) {
return fileLines.stream()
.filter(Objects::nonNull)
.filter(line -> !line.isEmpty())
.map(line -> {
int index = line.lastIndexOf(",");
if (index > 0) {
return line.substring(0, index);
}

return line;
})
.sorted()
.collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private Map<String, Object> getSchemas() {
Map<String, Schema> turnOnOffPayloadProperties = new HashMap<>();
lightMeasuredPayloadProperties.put("command", Schema.builder()
.type(Type.STRING)
.enumValues(Arrays.asList("on", "off"))
.enumValue(Arrays.asList("on", "off"))
.description("Whether to turn on or off the light.")
.build()
);
Expand Down
2 changes: 1 addition & 1 deletion asyncapi-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>asyncapi</artifactId>
<groupId>com.asyncapi</groupId>
<version>1.0.0-EAP</version>
<version>1.0.0-EAP-1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.asyncapi</groupId>
<artifactId>asyncapi</artifactId>
<version>1.0.0-EAP</version>
<version>1.0.0-EAP-1</version>

<!-- Project Information -->
<name>AsyncAPI</name>
Expand Down