Skip to content

No Json deserializer found for type #41

Closed
@eyasuyuki

Description

@eyasuyuki

I use this swagger spec.

swagger: "2.0"
info:
  version: 1.0.0
  title: example
basePath: /v1
schemes:
  - http
consumes:
  - application/json
produces:
  - application/json
paths:
  /user:
    get:
      summary: List all users
      operationId: listUser
      tags:
        - user
      responses:
        "200":
          description: An paged array of users
          headers:
            x-next:
              type: string
              description: A link to the next page of responses
          schema:
            type: array
            items:
              $ref: '#/definitions/User'
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      summary: Create a User
      operationId: createUser
      tags:
        - user
      parameters:
        - name: name
          in: query
          type: string
          required: true
      responses:
        "200":
          description: created User
          schema:
            $ref: '#/definitions/User'
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/Error'
  /user/{id}:
    get:
      summary: Info for a specific pet
      operationId: showUserById
      tags:
        - user
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the user to retrieve
          type: integer
      responses:
        "200":
          description: Expected response to a valid request
          schema:
            $ref: '#/definitions/User'
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      summary: Modify user
      operationId: putUser
      tags:
        - user
      parameters:
        - name: id
          in: path
          required: true
          description: User id
          type: integer
        - name: body
          in: body
          required: true
          schema:
            $ref: '#/definitions/User'
      responses:
        "200":
          description: User modified
          schema:
            $ref: '#/definitions/User'
        default:
          description: unexpetded error
          schema:
            $ref: '#/definitions/Error'
definitions:
  User:
    properties:
      id:
        type: integer
        format: int64
      name:
        type: string
      money:
        type: object
        allOf:
          - $ref: '#/definitions/Money'
  Money:
    properties:
      id:
        type: integer
        format: int64
      userId:
        type: integer
        format: int64
      amount:
        type: number
      createDate:
        type: string
        format: date-time
  Error:
    required:
      - code
      - message
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string

I got these error.

play.sbt.PlayExceptions$CompilationException: Compilation error[No Json deserializer found for type example.yaml.UserMoney. Try to implement an implicit Reads or Format for this type.]
	at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
	at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
	at scala.Option.map(Option.scala:145)
	at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:49)
	at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44)
	at scala.Option.map(Option.scala:145)
	at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44)
	at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40)
	at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17)
	at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17)

project/plugins.sbt

resolvers += Resolver.url("sbt-plugins", url("http://dl.bintray.com/zalando/sbt-plugins"))(Resolver.ivyStylePatterns)

resolvers += "zalando-bintray"  at "https://dl.bintray.com/zalando/maven"

resolvers += "scalaz-bintray"   at "http://dl.bintray.com/scalaz/releases"

addSbtPlugin("com.typesafe.play" % "sbt-plugin"       % "2.5.4")

addSbtPlugin("de.zalando" % "sbt-api-first-hand" % "0.2.0")

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions