All Downloads are FREE. Search and download functionalities are using the official Maven repository.

alloy.SimpleRestJson.scala Maven / Gradle / Ivy

There is a newer version: 0.19.0-41-91762fb
Show newest version
package alloy

import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.constant

/** A rest protocol that deals with JSON payloads only
  * in HTTP requests and responses. These are encoded with
  * the content type `application/json`.
  * See Alloy documentation for more information.
  */
final case class SimpleRestJson()

object SimpleRestJson extends ShapeTag.Companion[SimpleRestJson] {
  val id: ShapeId = ShapeId("alloy", "simpleRestJson")

  val hints: Hints = Hints(
    smithy.api.ProtocolDefinition(traits = Some(List(smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "default")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "error")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "http")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpError")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpHeader")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpLabel")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpPayload")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpPrefixHeaders")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpQuery")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpQueryParams")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "httpResponseCode")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "jsonName")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "length")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "pattern")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "range")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "required")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "smithy.api", name = "timestampFormat")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "alloy", name = "uuidFormat")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "alloy", name = "discriminated")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "alloy", name = "nullable")), smithy.api.TraitShapeId(smithy4s.ShapeId(namespace = "alloy", name = "untagged")))), noInlineDocumentSupport = None),
    smithy.api.Documentation("A rest protocol that deals with JSON payloads only\nin HTTP requests and responses. These are encoded with\nthe content type `application/json`.\nSee Alloy documentation for more information."),
    smithy.api.Trait(selector = Some("service"), structurallyExclusive = None, conflicts = None, breakingChanges = None),
  ).lazily

  implicit val protocol: smithy4s.Protocol[SimpleRestJson] = new smithy4s.Protocol[SimpleRestJson] {
    def traits: Set[ShapeId] = Set(ShapeId("smithy.api", "default"), ShapeId("smithy.api", "error"), ShapeId("smithy.api", "http"), ShapeId("smithy.api", "httpError"), ShapeId("smithy.api", "httpHeader"), ShapeId("smithy.api", "httpLabel"), ShapeId("smithy.api", "httpPayload"), ShapeId("smithy.api", "httpPrefixHeaders"), ShapeId("smithy.api", "httpQuery"), ShapeId("smithy.api", "httpQueryParams"), ShapeId("smithy.api", "httpResponseCode"), ShapeId("smithy.api", "jsonName"), ShapeId("smithy.api", "length"), ShapeId("smithy.api", "pattern"), ShapeId("smithy.api", "range"), ShapeId("smithy.api", "required"), ShapeId("smithy.api", "timestampFormat"), ShapeId("alloy", "uuidFormat"), ShapeId("alloy", "discriminated"), ShapeId("alloy", "nullable"), ShapeId("alloy", "untagged"))
  }


  implicit val schema: Schema[SimpleRestJson] = constant(SimpleRestJson()).withId(id).addHints(hints)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy