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

publish 5.0.3-RC.1 #1266

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pipeline {
anyOf {
branch 'master'
branch 'develop'
branch 'release/*'
}
}
steps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ object OasWebApiDeclarations {
declarations.traits = d.traits
declarations.securitySchemes = d.securitySchemes
declarations.responses = d.responses
declarations.annotations = d.annotations // FOR OAS -> RAML CONVERSION
declarations // add withs methods?
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ import amf.core.internal.plugins.render.RenderConfiguration
import amf.core.internal.remote.{Oas20, Oas30, Spec}
import amf.core.internal.render.SpecOrdering
import amf.core.internal.render.emitters._
import amf.shapes.internal.spec.common.emitter.annotations.{FacetsInstanceEmitter, OasFacetsInstanceEmitter}
import amf.shapes.internal.spec.common.emitter.annotations.{
AnnotationEmitter,
FacetsInstanceEmitter,
OasAnnotationEmitter,
OasFacetsInstanceEmitter
}
import amf.shapes.internal.spec.common.emitter._
import amf.shapes.internal.spec.common.{OAS20SchemaVersion, OAS30SchemaVersion, SchemaPosition, SchemaVersion}
import amf.shapes.internal.spec.contexts.emitter.oas.{CompactableEmissionContext, OasCompactEmitterFactory}
Expand Down
4 changes: 2 additions & 2 deletions amf-apicontract.versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
amf.apicontract=5.1.0-SNAPSHOT
amf.aml=6.1.0-SNAPSHOT
amf.apicontract=5.0.3-RC.1
amf.aml=6.0.3-RC.0
amf.model=3.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"swagger": "2.0",
"info": {
"title": "BulkSMS JSON",
"version": "1.0.0"
},
"tags": [
{
"name": "Message",
"x-displayName": "Messages"
},
{
"name": "Profile",
"x-displayName": "Profile"
}
],
"paths": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#%RAML 1.0
title: EWB Api
version: v1

types:
Customer:
type: object
properties:
firstName: string
example:
firstName: asdf

resourceTypes:
collection:
post?:
body:
application/json:
type: <<item>>

/customers:
type:
collection:
item: Customer
post:
body:
application/json:
type:
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class AMFModelAssertionTest extends AsyncFunSuite with Matchers {
val oasConfig: AMFConfiguration = OASConfiguration.OAS30().withRenderOptions(ro)
val oasClient: AMFBaseUnitClient = oasConfig.baseUnitClient()

def modelAssertion(path: String, pipelineId: String = PipelineId.Default, parseOnly: Boolean = false)(
def modelAssertion(path: String, pipelineId: String = PipelineId.Default, transform: Boolean = true)(
assertion: BaseUnit => Assertion): Future[Assertion] = {
val parser = APIConfiguration.API().baseUnitClient()
parser.parse(path) flatMap { parseResult =>
if (parseOnly) assertion(parseResult.baseUnit)
if (!transform) assertion(parseResult.baseUnit)
else {
val specificClient = configFor(parseResult.sourceSpec).baseUnitClient()
val transformResult = specificClient.transform(parseResult.baseUnit, pipelineId)
Expand Down Expand Up @@ -144,7 +144,7 @@ class AMFModelAssertionTest extends AsyncFunSuite with Matchers {
// github issue #1121
test("Declared Raml type with Json Schema should inherit type from it") {
val ramlApi = s"$basePath/raml/json-schema-scalar-type/json-schema-with-scalar-type.raml"
modelAssertion(ramlApi, parseOnly = true) { bu =>
modelAssertion(ramlApi, transform = false) { bu =>
val jsonSchemaType = "http://www.w3.org/2001/XMLSchema#string"
val declaredTypeWithJsonSchemaNode =
bu.asInstanceOf[Document].declares.head.asInstanceOf[ScalarShape]
Expand All @@ -154,7 +154,7 @@ class AMFModelAssertionTest extends AsyncFunSuite with Matchers {

test("Declared Raml type with Json Schema in external file should inherit type from it") {
val ramlApi = s"$basePath/raml/json-schema-scalar-type/json-schema-with-scalar-type-in-external-file.raml"
modelAssertion(ramlApi, parseOnly = true) { bu =>
modelAssertion(ramlApi, transform = false) { bu =>
val jsonSchemaType = "http://www.w3.org/2001/XMLSchema#string"
val declaredTypeWithJsonSchemaNode =
bu.asInstanceOf[Document].declares.head.asInstanceOf[ScalarShape]
Expand Down Expand Up @@ -196,4 +196,13 @@ class AMFModelAssertionTest extends AsyncFunSuite with Matchers {
}
}
}

test("different datatypes should not fall under simple inheritance") {
val api = s"$basePath/raml/merge-resourceType.raml"
ramlClient.parse(api) flatMap { parseResult =>
val transformResult = ramlClient.transform(parseResult.baseUnit, PipelineId.Editing)
// parsing or resolution results are not relevant
ramlClient.validate(transformResult.baseUnit) map (report => report.results.size shouldBe 0)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ sealed case class ShapeCanonizer()(implicit val context: NormalizationContext) e
ShapeModel.Description,
AnyShapeModel.Examples,
AnyShapeModel.Documentation,
AnyShapeModel.Comment,
ScalarShapeModel.DataType
AnyShapeModel.Comment
)
fieldsPresentInSuperType(shape, superType, ignoredFields)
case _ => false
Expand Down