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

Added JsonSchemaDocument wrapper #1533

Merged
merged 1 commit into from
Aug 4, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import amf.core.client.scala.model.StrField
import amf.core.client.scala.model.document.Document
import amf.core.client.scala.model.domain.Shape
import amf.core.internal.parser.domain.{Annotations, Fields}
import amf.shapes.client.scala.model.domain.AnyShape
import amf.shapes.internal.document.metamodel.JsonSchemaDocumentModel
import amf.shapes.internal.document.metamodel.JsonSchemaDocumentModel.SchemaVersion

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package amf.shapes.internal.convert

import amf.aml.internal.convert.VocabulariesBaseConverter
import amf.core.internal.convert.{BidirectionalMatcher, CoreBaseConverter}
import amf.core.internal.convert.BidirectionalMatcher
import amf.core.internal.unsafe.PlatformSecrets
import amf.shapes.client.platform.config.{AMFSemanticSchemaResult => ClientAMFSemanticSchemaResult, SemanticJsonSchemaConfiguration => ClientSemanticJsonSchemaConfiguration}
import amf.shapes.client.platform.model.document.{JsonSchemaDocument => ClientJsonSchemaDocument}
import amf.shapes.client.scala.model.document.JsonSchemaDocument
import amf.shapes.client.platform.model.domain
import amf.shapes.client.platform.{ShapesConfiguration => ClientShapesConfiguration}
import amf.shapes.client.platform.config.{SemanticJsonSchemaConfiguration => ClientSemanticJsonSchemaConfiguration}
import amf.shapes.client.scala.ShapesConfiguration
import amf.shapes.client.scala.config.{AMFSemanticSchemaResult, SemanticJsonSchemaConfiguration}
import amf.shapes.client.platform.config.{AMFSemanticSchemaResult => ClientAMFSemanticSchemaResult}
import amf.shapes.client.scala.model.domain._
import amf.shapes.client.scala.model.domain.federation._
import amf.shapes.client.scala.model.domain.operations.{
ShapeOperation,
ShapeParameter,
ShapePayload,
ShapeRequest,
ShapeResponse
}
import amf.shapes.client.scala.model.domain.operations._

trait ShapesBaseConverter
extends VocabulariesBaseConverter
Expand Down Expand Up @@ -48,6 +43,7 @@ trait ShapesBaseConverter
with PropertyKeyMappingConverter
with ExternalPropertyShapeConverter
with KeyConverter
with JsonSchemaDocumentConverter

trait NilShapeConverter extends PlatformSecrets {

Expand Down Expand Up @@ -278,3 +274,10 @@ trait KeyConverter extends PlatformSecrets {
override def asInternal(from: domain.federation.Key): federation.Key = from._internal
}
}

trait JsonSchemaDocumentConverter extends PlatformSecrets {
implicit object JsonSchemaDocumentMatcher extends BidirectionalMatcher[JsonSchemaDocument, ClientJsonSchemaDocument] {
override def asClient(from: JsonSchemaDocument): ClientJsonSchemaDocument = ClientJsonSchemaDocument(from)
override def asInternal(from: ClientJsonSchemaDocument): JsonSchemaDocument = from._internal
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import amf.core.client.platform.model.domain.RecursiveShape
import amf.core.internal.convert.UniqueInitializer
import amf.core.internal.remote.Platform
import amf.core.internal.unsafe.PlatformSecrets
import amf.shapes.client.platform.model.document.JsonSchemaDocument
import amf.shapes.client.platform.model.domain._
import amf.shapes.client.platform.model.domain.federation._
import amf.shapes.client.scala.model
import amf.shapes.internal.document.metamodel.DataTypeFragmentModel
import amf.shapes.internal.document.metamodel.JsonSchemaDocumentModel
import amf.shapes.internal.domain.metamodel._
import amf.shapes.internal.domain.metamodel.federation._
import amf.shapes.internal.domain.metamodel.operations._
Expand Down Expand Up @@ -107,6 +108,9 @@ private[amf] object ShapesRegister extends UniqueInitializer with PlatformSecret
platform.registerWrapper(ExternalPropertyShapeModel) {
case s: amf.shapes.client.scala.model.domain.federation.ExternalPropertyShape => ExternalPropertyShape(s)
}
platform.registerWrapper(JsonSchemaDocumentModel) {
case s: amf.shapes.client.scala.model.document.JsonSchemaDocument => JsonSchemaDocument(s)
}
}

}