Giter Site home page Giter Site logo

ebowman / api-first-hand Goto Github PK

View Code? Open in Web Editor NEW
141.0 15.0 22.0 1.32 MB

API-First bootstrapping tool for building RESTful web services from a Swagger/OpenAPI spec

License: MIT License

Scala 99.11% HTML 0.89%
swagger-specification scala play-framework swagger-api sbt-plugin

api-first-hand's Introduction

Api-First-Hand: API-First Bootstrapping Tool for Swagger/OpenAPI specs

Build Status codecov Gitter Chat

Table of Contents

Intro to API-First-Hand

API-First-Hand is an API-First bootstrapping tool for building RESTful web services from a Swagger/OpenAPI specification. Constructed as a plugin, it takes your Swagger/OpenAPI definition as the single source of truth and regenerates these code snippets for you, simply and consistently. Instead of writing lots of boilerplate code, you can focus instead on implementing service business logic. Subsequent regenerations keep the code that you have added—either by commenting out the parts that are no longer valid, or by adding parts that are needed because you've changed the API.

We built API-First-Hand for use with Play Framework, but we would like to extend it for use with Akka HTTP. Get in touch if you'd like to help make that possible.

Plugin Features

Api-First-Hand supports round-trip regeneration and compilation of:

  • Play route definitions (managed)
  • Swagger domain model definitions and parameters onto Scala case classes (managed)
  • Swagger domain model constraints onto Play validations (managed)
  • Generators for random test data and parameter values (managed)
  • Unit tests for invalid and valid parameter sets // validating your service at the API boundary (managed)
  • Swagger path definitions onto skeletons for Play controller implementations (unmanaged)
  • Wrappers for Play route files to convert semantics from HTTP-related to domain-related controller_base (managed)
  • Model classes and validation rules
  • Security extractors (manual generation and compilation)
  • Unmarshallers for custom content types (manual generation and compilation)

Managed means "managed by sbt"—and this means that you don't have to control or change the code as you make your REST service. The security extractors and unmarshallers are available through manual generation and compilation, and supported if A) No security extractor or unmarshaller with the same name already exists; B) The developer issues the playScalaSecurity or playScalaMarshallers sbt command.

Build Status and Requirements

API-First-Hand is under active development and should not be considered production-ready.

To use the plugin, you need:

  • Play Framework 2.5.4+
  • Swagger (OpenAPI) 2.0
  • the Activator template, hosted by Lightbend

More About the Activator Template

The Activator template provides a sandbox for your application to run with API-First-Hand. (Download Activator here, then follow the instructions). It contains the following:

  • HTML tutorial (found here)
  • the Swagger UI frontend included as static files, run from within Play (located in the public/swagger folder)
  • a pre-configured plugins.sbt file with a definition of all required resolvers and plugins (found in the project folder)
  • a conf folder with the following customized contents:
    • routes file with route configuration for Swagger UI, example specification, and commented-out links to other examples
    • A template Swagger API definition called example.yaml, with a dummy implementation in the app folder
    • examples folder containing additional Swagger specification examples, each representing some aspect of Api-First-Hand in greater detail. For the plugin to pick up the specification, move it into the conf folder. You can simultaneously have multiple Swagger specifications in the conf folder.
  • app directory with following template implementations:
    • controllers/Swagger.scala: a backend side of the Swagger UI
    • generated_controllers/example.yaml.scala: a dummy implementation of the example controller that's (re)generated if deleted
    • security/example.yaml.scala: a marshaller for OAuth2 tokens. Will not be regenerated until either deleted or renamed; and then explicitly requested by issuing a playScalaSecurity command.

Getting Started with API-First-Hand

Creating Your Play Application with the Plugin

  • Use the Activator template, for example: activator new hello-world api-first-hand
  • Look at the project/plugins.sbt of your generated project and add the required plugins and resolvers there
  • Do the same for build.sbt
  • Put a Swagger specification with a .yaml or .json extension into the conf directory
  • Add a specification link (->) to the Play's routes file

Running Your Application with the Plugin

Now let's run your application with the plugin:

  • Open a shell and cd into your service project directory.
  • Start sbt and run the service.
  • View the running application at http://localhost:9000.

A single specification defines a single API; in our case, these are three API endpoints:

  • The GET /token API plays a role of an authentication server and is used by the Swagger UI for OAuth token requests.
  • The POST /token API represents an authorization server and is used by the security part of the generated code to validate OAuth tokens.
  • The GET /todos/{user_id} takes a path parameter user_id and returns a TODO list for the given user. Use security/example.yaml.scala, the marshaller for OAuth2 tokens, to request an OAuth token with the scope admin:org. This will grant permission for the client to access this endpoint and enable you to test the API.

Click the default button to expand the API definition in the Swagger UI. You can change the specification or write some backend code and use the Swagger UI to see the results.

Play Routes Integration

Play application developers are used to defining endpoints in the conf/routes file. With Api-First-Hand, however, Swagger API specifications already define endpoints as path definitions—saving you from doing the work twice. Just link your API definition in the routes file once. This makes all Swagger API-defined endpoints available as children of a single path context location, and generates Play route definitions from them (as shown below):

->      /example        example.yaml.Routes

The conf/routes file provided by the Activator template also contains additional GET mappings required for the Swagger UI sandbox, and some commented-out links to other examples. If you activate some specification by moving it from the examples folder into the conf folder, you'll have to uncomment an appropriate line in the routes file so that Play can find routes generated for it.

Model Definitions

API-First-Hand generates Scala domain model definitions for all data types defined as Swagger parameters in an API specification. Swagger parameters can be of path, query, header, form or body types, and consist of either primitive data types or more complex types composed from objects and arrays with primitives as leaves. Both primitive types and complex types are mapped to Scala.

For more information and an example, go here.

Primitive Types

Swagger version 2.0 allows for primitive data types based on the types defined by JSON-Schema. When generated as Scala, the mapping indicated in this chart applies.

Complex Types: Objects and Arrays

Complex types are made up of either primitive objects or nested objects. Go here for details and examples related to Objects (nested objections, optionality, object extensions, polymorphism, and additional properties) and Arrays (including nested arrays).

Specification Cross-References

You can use a filename to reference part of another specification with the $ref element. You can split a single specification into multiple files (as shown in cross_spec_references.yaml), and also reference a definition in one specification across other specifications. (For example, you can create domain_model.yaml and then reference it from any other API specification.)

An independent copy of the class definition is created for each referencing specification. The definition is then placed into the appropriate package for each specification.

Therefore, even if multiple classes with the same name and structure are generated, they all will coexist in their own separate namespaces and won't be interchangeable. (We plan to change this in future versions.)

Swagger Validations

Swagger API definitions allow you to impose constraints on parameter types. You can use the required constraint to mark a parameter or specific field within a domain definition, as required upon input. You can also add to your API definition more constraints, as defined by the Parameter Object. API-First-Hand will generate validations for these parameter constraints and make sure that your controller methods are only called if the input of your service complies to those constraints.

Go here for more information and examples.

Go here for more detailed information about test generators.

About API-First-Hand: Architecture and Structure

to build a plugin from sources, do the following:

  • Clone the repository to your local filesystem
  • Publish the plugin into your local ivy repository by running sbt publishLocal in the API-First-Hand directory

Plugin Architecture

Api-First-Hand has a three-tier architecture, with pluggable specification parsers and pluggable artefact generators:

  • Specification, responsible for finding and parsing a specification and converting it into raw AST format
  • Normalization, which performs optimiztions on the AST—including type deduplication, flattening and parameter dereferencing
  • generation, a final step including transformation of the AST into source code-related data and generation of source code from it

By separating the specification and generation tiers, we can plug in different specification standards and generate source code for different frameworks.

Plugin Project Structure

There are a couple of sub-projects:

  • swagger-model: A standalone Scala Swagger model with Jackson parser. Can be used by another projects.
  • api: Automatically added to the runtime classpath of any projects using API-First-Hand.
  • swagger-parser: A converter of the Swagger model to the internal AST of the plugin
  • api-first-core: This is a core of the plugin with minimal functionality. It includes defining an AST structure and some transformations on AST.
  • play-scala-generator: The standalone generator for transforming an AST into the skeleton of Play-Scala application.
  • plugin: sbt plugins, one for each tier:
    • ApiFirstSwaggerParser: wraps the Swagger-parsing part
    • ApiFirstCore: wrapper for AST-related functionality
    • ApiFirstPlayScalaCodeGenerator: a wrapper for the Play-Scala generator

You must enable each module separately in sbt's build.sbt and configure which parser(s) the plugin will use, like this:

lazy val root = (project in file(".")).enablePlugins(PlayScala, ApiFirstCore, ApiFirstPlayScalaCodeGenerator, ApiFirstSwaggerParser)

apiFirstParsers := Seq(ApiFirstSwaggerParser.swaggerSpec2Ast.value).flatten

Check out the Activator template's configuration for a complete example.

Custom Templates for Code Generation

The PlayScala generator supports custom templates. In order to override default template for some of the components, please provide your custom template named in accordance to the following list:

  • play_scala_test.mustache: for unit tests
  • play_validation.mustache: for validators
  • generators.mustache: for test data generators
  • model.mustache: for model classes and query and path bindables
  • play_scala_controller_base.mustache: for Play controller bases
  • play_scala_controller_security.mustache: for security adapters used by controller bases
  • play_scala_form_parser.mustache: for form parsers used by the controller bases
  • play_scala_controller.mustache: for Play controller skeletons; you can augment them
  • play_scala_response_writers.mustache: for custom serializers; you can augment them
  • play_scala_security_extractors.mustache: for custom security extractors; you can augment them

Generated artifacts must preserve some specific shape to be compiled together without errors.

You must configure the location for custom templates by overriding the plugin setting playScalaCustomTemplateLocation. For example, this configuration will set the project's conf/templates folder as the location:

playScalaCustomTemplateLocation := Some(((resourceDirectory in Compile) / "templates").value)

Plugin Developing

sbt doesn't allow sub-projects to depend on each other as sbt plugins. To test an sbt plugin, you need a separate project. This project is swagger-tester. To test your changes as you're developing the plugin, cd into this directory, and run sbt. This project uses an sbt ProjectRef to the sbt plugin, which means you don't need to publishLocal the plugin after each change. Just run reload in the sbt console, and it will pick up your changes.

API-First-Hand provides a few commands useful for development:

  • apiFirstPrintDenotations: outputs common names of different parts of the AST as they are intended for use in generated Scala code
  • apiFirstPrintRawAstTypes: outputs all type definitions as they read from the specification before type optimizations
  • apiFirstPrintRawAstParameters: outputs all parameters definitions before type optimizations
  • apiFirstPrintFlatAstTypes: outputs type definitions after type optimizations
  • apiFirstPrintFlatAstParameters: outputs parameter definitions after type optimizations

Plugin Testing

We're using the sbt scripted framework for testing. You can find the tests in plugin/src/sbt-test and run them by running scripted in the sbt console.

Code Quality

Some quality checks are embedded into the build script:

  • the source code is (re)formatted using scalariform each time it is compiled (currently deactivated).
  • scalastyle sbt command: use this to perform code style checks before putting changes into the repository
  • lint:compile sbt command: use this to perform static code analysis before putting changes into the repository
  • Execute code coverage for API and compiler modules with the sbt clean coverage test command. Generate coverage statistics with the coverageReport sbt command.

command shall be used to ... before putting changes into the repository

api-first-hand's People

Contributors

benmccann avatar eyasuyuki avatar gipeshka avatar nequissimus avatar s12v avatar slavaschmidt avatar zyv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-first-hand's Issues

Number parsing

I have this issue :
parsing default 0 value into a type: number, format: double.
<p id="detail" class="pre">[ClassCastException: java.lang.Integer cannot be cast to java.lang.Double]</p>

parsing default 3.3 value into a type: number, format: float.
<p id="detail" class="pre">[ClassCastException: java.lang.Double cannot be cast to java.lang.Float]</p>

With

  geometry:
      type: object
      properties:
        coordinates:
          type: array
          items:
            type: number
            format: double
            example: [4.49965, 52.06891]

parsing in a post body :

      "coordinates": [
        [
          4.49965,
          52.06891
        ]
      ]

Returns
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[ClassCastException: scala.collection.immutable.$colon$colon cannot be cast to java.lang.Double]]

capture d ecran 2016-07-25 a 15 51 29

Not able to serve index.html at custom url

The plugin works smoothly with minor tweaks but I am not able to serve index.html at custom endpoint.

The swagger UI lods fine at:
GET / controllers.Assets.versioned(path="/public/swagger", file: Asset = "index.html")
GET /index.html controllers.Assets.versioned(path="/public/swagger", file: Asset = "index.html")

but if I try to serve the same at, for example

GET /myservice/v1/swagger controllers.Assets.versioned(path="/public/swagger", file: Asset = "index.html")

it never loads the swagger UI.

Is there something i am missing ? or there is a bug in the library ?

No Json deserializer found for type

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")

Help with int64 & date-time

Hi,
i tried to implement the api in a project, but i have some problems with the data types:

When i send a number i get (integer & format: int64 in swagger):

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[ClassCastException: java.lang.Integer cannot be cast to java.lang.Long]]

and when i send a date-time object from swagger i get:

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[JsonMappingException: Can not instantiate value of type [simple type, class java.time.ZonedDateTime] from String value ('2017-03-25T11:58:04.522Z'); no single-String constructor/factory method at [Source: [B@4dc50d3; line: 17, column: 14] (through reference chain: Contact["created"])]]

Do you have an idea what's the problem?

Greetings Tobias

Required properties validation

Endpoint:

parameters:
  - name: query
    in: body
    required: true
    schema:
      "$ref": "#/definitions/Query"

definition:

  Query:
    type: object
    required:
      - language
    properties:
      language:
        type: string

request body:

{
}

Expected result: validation error (language property is required)
Actual result: no errors

Enum cannot be found if used as a schema definition

Example spec:

swagger: '2.0'
info:
  title: Failing spec
  description: Failing spec
  version: '0.0.2'
schemes:
  - http
consumes:
  - application/json
produces:
  - application/json

paths:
  /:
    post:
      parameters:
        - name: body
          in: body
          required: true
          schema:
            $ref: '#/definitions/AckStatus'
      responses:
        '200':
          description: 200
          schema:
            type: array
            items:
              $ref: '#/definitions/AckStatus'

definitions:

  AckStatus:
    type: string
    enum: [ "Acknowledged", "Not Ack", "In Work" ]

Activator Template contents: checking/updating

Hey @slavaschmidt:

In this section, https://github.com/LappleApple/api-first-hand/blob/master/README.md#more-about-the-activator-template, I'm wondering ..

  • HTML tutorial (found in the tutorial folder) ... does this folder still exist in the template? I just went here and downloaded "Template Bundle for "Api-First-Hand activator template." I can't find a tutorial version in the zip.
  • A template Swagger API definition called example.yaml, with a dummy implementation in the app folder : can you provide the name of the file in the app folder that includes the dummy implementation?

I'm also trying to get the language updated for the tutorial here; it still uses play-swagger :).

Must comment out additionalProperties: false for it to work

No following schema fails to compile

  failureResponse:
    type: object
    properties:
      reason:
        type: string
        maxLength: 255
        description: a simple description for the failure
    required:
    - reason
    # additionalProperties: false
rror] (compile:swaggerParseSpec) com.fasterxml.jackson.core.JsonParseException: Can not instantiate value of type [simple type, class de.zalando.swagger.strictModel$Schema] from Boolean value (false); no single-boolean/Boolean-arg constructor/factory method
[error]  at [Source: N/A; line: -1, column: -1] (through reference chain: de.zalando.swagger.Schema["additionalProperties"]) through reference chain: paths → /customer-subscriptions → post → responses → default → schema

Easy question: Which of these exist vs. which of these are still in plans?

Hi @slavaschmidt and @ALL maintainers:

The README says: "The status of this software is beta, an end-to-end functional release intended to demonstrate the possibility to generate following from a Swagger specification:

  • Play route files
  • Generators of random test data
  • Wrappers for Play route files to convert semantics from http-related to domain-related (controller_base)
  • Skeletons for the domain-driven controller implementation
  • Model classes and validation rules
  • Unit tests for invalid and valid parameter sets
  • Security extractors (if needed)
  • Skeletons for custom deserializers (if needed)"

Which of these things exist in the current version? Which ones do not, and are highly desired?

Not found: type SecurityExtractors

Hi,

I'm having issues using securityDefinitions.
I try compiling security.api.yamlbut sbt returns :

[error] /Users/poc/workspace/speculos/target/scala-2.11/routes/main/security/security.api.yaml.scala:10: not found: type SecurityExtractors
[error] trait SecurityApiYamlSecurity extends SecurityExtractors {

I call find how to b) explicitly requested by issuing a apiFirstSecurity command. Command seems to be missing.

Documentation should be updated to mentionApiFirstPlayScalaCodeGenerator.playScalaSecurity.

The names for the enum members are not valid scala identifiers

The example spec:

swagger: '2.0'
info:
  title: Failing spec
  description: Failing spec
  version: '0.0.2'
schemes:
  - http
consumes:
  - application/json
produces:
  - application/json

paths:
  /:
    get:
      responses:
        '200':
          description: 200
          schema:
            type: string
            enum: [ "Status One", "Status Two", "Status Three" ]

Integration tests (sbt scripted) fail for the current master branch (0.2.0)

Here is the abridged output of sbt scripted, I suspect that the failing test have to do with the output tagged as [error]:

[error] [pool-11-thread-5] WARN de.zalando.swagger.ValidationsConverter$ - Ignoring nonsense validations for date: maxLength(10), minLength(0), pattern("""/[1-9][A-Z0-9]*/""".r)
[error] [pool-11-thread-5] WARN de.zalando.swagger.ValidationsConverter$ - Ignoring nonsense validations for date-time: maxLength(10), minLength(1), pattern("""/[1-9][A-Z0-9]*/""".r)
[error] [pool-11-thread-5] WARN de.zalando.swagger.ValidationsConverter$ - Ignoring nonsense validations for date-time: maxLength(10), minLength(0), pattern("""/[1-9][A-Z0-9]*/""".r)
[error] [pool-11-thread-5] WARN de.zalando.swagger.ValidationsConverter$ - Ignoring nonsense validations for date: maxLength(10), minLength(0), pattern("""/[1-9][A-Z0-9]*/""".r)
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path(), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/{id} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("schema" / "model"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("schema" / "model"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("schema" / "model"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/findByTags , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint PUT /pets , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint POST /pets , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/{petId} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint POST /pets/{petId} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint DELETE /pets/{petId} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/findByStatus , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("stores" / "order"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithList"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call PUT Path("users" / "{username}"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithArray"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("stores" / "order"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithList"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call PUT Path("users" / "{username}"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithArray"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("string"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("string2"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("string"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("string2"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path(), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path(), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("test-path" / "{id}"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/findByTags , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint PUT /pets , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint POST /pets , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/{petId} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint POST /pets/{petId} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint DELETE /pets/{petId} , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] INFO de.zalando.apifirst.generators.ScalaPlayCallEnricher - Not generating tests for secure API endpoint GET /pets/findByStatus , this issue will be addressed in future versions of the plugin
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("stores" / "order"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithList"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call PUT Path("users" / "{username}"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithArray"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("stores" / "order"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithList"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call PUT Path("users" / "{username}"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path("users" / "createWithArray"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("schema" / "model"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("schema" / "model"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path("schema" / "model"), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call GET Path(), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path(), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path(), defaulting to MimeType("application/json")
[error] [pool-11-thread-3] WARN de.zalando.apifirst.generators.ScalaPlaySpecEnricher - No mime-types is defined for call POST Path(), defaulting to MimeType("application/json")
...
[info] [error] Failed: Total 98, Failed 59, Errors 0, Passed 39
[info] [error] Failed tests:
[info] [error] 	numbers_validation.yaml.Numbers_validationYamlSpec
[info] [error] 	heroku.petstore.api.yaml.HerokuPetstoreApiYamlSpec
[info] [error] 	nakadi.yaml.NakadiYamlSpec
[info] [error] 	cross_spec_references.yaml.Cross_spec_referencesYamlSpec
[info] [error] 	full.petstore.api.yaml.FullPetstoreApiYamlSpec
[info] [error] 	echo.EchoApiYamlSpec
[info] [error] 	form_data.yaml.Form_dataYamlSpec
[info] [error] 	error_in_array.yaml.Error_in_arrayYamlSpec
[info] [error] 	admin.SimplePetstoreApiYamlSpec
[info] [error] 	hackweek.yaml.HackweekYamlSpec
[info] [error] 	split.petstore.api.yaml.SplitPetstoreApiYamlSpec
[info] [error] 	string_formats_validation.yaml.String_formats_validationYamlSpec
[info] [error] 	uber.api.yaml.UberApiYamlSpec
[info] [error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[info] [error] Total time: 57 s, completed Dec 19, 2016 12:00:06 PM
[info] + swagger / compile
[success] Total time: 333 s, completed Dec 19, 2016 12:00:07 PM

OperationId required to generate lowerCamelCased action names

paths:
  /options:
    post:
      operationId: postOptions

will generate val postOptions = postOptionsAction{}

paths:
  /options:
    post:

will generate val postoptions = postoptionsAction{}

Action name generator should create valid lowerCamelCased action names.

Add DI unmanaged area

Currently the generated code includes areas for constructor and actions, which look basically like this:

...
class SomeService @Inject() (lifecycle: ApplicationLifecycle, config: ConfigurationProvider) extends SomeServiceBase {
        // ----- Start of unmanaged code area for constructor SomeService

        // ----- End of unmanaged code area for constructor SomeService
        val someOperation = someOperationAction { input: (String, String) =>
            val (someInput, someOther) = input
            // ----- Start of unmanaged code area for action  SomeService.someOperation
            NotImplementedYet
            // ----- End of unmanaged code area for action  SomeService.someOperation
        }
...

The idea here is adding support for DI so we can avoid using workarounds like getting injectors from the deprecated play.api.Play.current, creating object helpers to get the it from Guice.createInjector(SomeModule) or hardwiring dependencies directly.

Maybe it would be possible to implement in a way that we have the following header generated:

...
class SomeService @Inject() (
        // ----- Start of unmanaged code area for dependencies to be injected in SomeService

        // ----- End of unmanaged code area for dependencies to be injected SomeService
        lifecycle: ApplicationLifecycle,
        config: ConfigurationProvider
) extends SomeServiceBase {
...

P.S.: If we have this, I believe a natural step forward would be a way to define a "controller delegate" which would be a class to be automatically injected, to where calls would be automatically forwarded if a matching method is found, so forwarding managed code gets generated in those cases and we can get to a level that the developer only touches own yaml and scala sources, no need to add lines in generated code

Enum: Value1 is already defined as value Value1

Hi,

I'm trying to define two properties, each with an enumeration containing an equal value.

definitions:
  Transition:
    type: object
    properties:
      trigger_state_value:
        type: string
        enum: ["completed","canceled"]
      child_state_value:
        type: string
        enum: ["canceled"]

I have this error Canceled is already defined as value Canceled; val Canceled = StateValueOpt("canceled") which makes sense considering the generated code.

You should probably change the val name generator.

No string constructor/factory method for date-time

With this yaml :

  task:
    type: object
    properties:
      complete_before:
        type: string
        format: date-time
      complete_after:
        type: string
        format: date-time

Using the generated example for the post :

{
  "complete_before": "2016-07-25T13:15:53.208Z",
  "complete_after": "2016-07-25T13:15:53.208Z"
}

triggers this error :

<p id="detail" class="pre">[JsonMappingException: Can not instantiate value of type [simple type, class org.joda.time.DateTime] from String value (&#x27;2016-07-25T13:07:40.517Z&#x27;); no single-String constructor/factory method
 at [Source: [B@4e6bc7b1; line: 34, column: 22] (through reference chain: workload.yaml.NewTask[&quot;complete_before&quot;])]</p>

But this is working :

{
  "complete_before": 1469452060,
  "complete_after": 1469452060,
}

create new release 0.2.0

I've seen that there are many improvements in the mustache templates in master.
In particular, the ability to add additional injects would be required by me.

could you please release a new version and publish it to maven central ?
That would be really great!

Thanks,
Dominik

generated tests fail on empty responses

If the test case expects a empty response the parsing seems to fail.

here's a snippet from my swagger file:

swagger: '2.0'
info:
  version: "0.0.0"
  title: Pets
produces:
  - application/json
consumes:
  - application/json
paths:
  /pets/{id}:
    get:
      description: get existing `Pet` object
      parameters:
        -
          name: id
          in: path
          description: pet id
          required: true
          type: string
          format: uuid

      responses:
        200:
          description: Successful response
          schema:
            $ref: '#/definitions/Pet'
        404:
          description: Pet not found

definitions:
  Pet:
    type: object
    properties:
      id:
        type: string
        format: uuid
      name:
        type: string
        minLength: 1
    required:
    - name

here's relevant part of the controller:

        val getpetsById = getpetsByIdAction { (id: UUID) =>  
            // ----- Start of unmanaged code area for action  PetYaml.getpetsById
            val pets = ...
            pets.find(_.id.contains(id)) match {
                case Some(p) => GetpetsById200(p)
                case None => GetpetsById404()
            }
            // ----- End of unmanaged code area for action  PetYaml.getpetsById
        }

Because the generated tests test a random id it always gets the 404 response. If I haven't specified a schema for that response the response parsing fails and so does the test. This can be fixed by defining an object for the 404 response.

running tests produces:

[info] GET /pets/{id}
[info] - should discard invalid data
[info] - should do something with valid data *** FAILED ***
[info]   Expected true but got false
[info]   Successful
[info]   Given response code [404], 'Content-Type' [application/json], 'Accept' header [application/json] and URL: [/pets/824d361c-7bad-494c-9a1b-42df21811fe5] given args: '824d361c-7bad-494c-9a1b-42df21811fe5' did not equal (pet.yaml.scala:571)

I think the generated tests should handle also empty responses gracefully.

Enum string validator fails

Hi guys,

We currently face an issue with string enum fields.
swagger file:

paths:
  /vendor:
    post:
      description: Common vendor search
      parameters:
        - name: query
          description: Complex query object
          in: body
          required: true
          schema:
            "$ref": "#/definitions/VendorQuery"

...

definitions:
  VendorQuery:
    type: object
    properties:
      opening_type:
        type: string
        enum:
          - delivery
          - pickup
          - open
          - closed

We have a resulting type Option[VendorQueryOpening_typeOpt] where VendorQueryOpening_typeOpt has the following definition:

    case class VendorQueryOpening_typeOpt(value: String) extends AnyVal {
        override def toString = value.toString
    }

We of course have a companion object as well:

    object VendorQueryOpening_typeOpt {
        
        val Delivery = new VendorQueryOpening_typeOpt("delivery")
        val Pickup = new VendorQueryOpening_typeOpt("pickup")
        val Open = new VendorQueryOpening_typeOpt("open")
        val Closed = new VendorQueryOpening_typeOpt("closed")

        implicit def stringToVendorQueryOpening_typeOpt: String => VendorQueryOpening_typeOpt = {
            case "delivery" => Delivery
            case "pickup" => Pickup
            case "open" => Open
            case "closed" => Closed
            case other =>
                throw new IllegalArgumentException("Couldn't parse parameter " + other)
        }
    }

But when one passes this opening_type in request we see the following error:

[ClassCastException: java.lang.String cannot be cast to swagger.yaml.VendorQueryOpening_typeOpt]

In /target/scala-2.11/routes/main/validators/swagger.yaml.scala:132

class VendorQueryOpening_typeValidator(instance: VendorQueryOpening_type) extends RecursiveValidator {
    override val validators = instance.toSeq.map { new VendorQueryOpening_typeOptValidator(_) }
}

When trying to instantiate VendorQueryOpening_typeOpt we get the following:

scala> import swagger.yaml.VendorQueryVendor_filter_policyOpt
import swagger.yaml.VendorQueryVendor_filter_policyOpt

scala> new VendorQueryVendor_filter_policyOpt("aaa")
java.lang.NoSuchMethodError: swagger.yaml.package$VendorQueryVendor_filter_policyOpt$.toString$extension(Ljava/lang/String;)Ljava/lang/String;
  at swagger.yaml.VendorQueryVendor_filter_policyOpt.toString(swagger.yaml.scala:70)

We use scala 2.11.8 and play 2.5.10 currently.

java.lang.NoSuchMethodError in JsonContext

I successfully used the activator playground template a week ago, but now I am getting the following error: In a newly activator created playground:
[error] (compile:swaggerParseSpec) java.lang.NoSuchMethodError: me.andrz.jackson.JsonContext.<init>(Ljava/io/File;I)V
Which is called from https://github.com/zalando/api-first-hand/blob/master/swagger-model/src/main/scala/de/zalando/swagger/StrictParser.scala#L35

A few things I noticed:

  • jackson-json-reference-core 0.2.1 just got rebuilt into maven central less than a day ago (no minor version bump for the new build, seems to just overwrite what was there).
  • There really is no constructor with parameters (File, Int) for a JsonContext that I could find
  • I get this error even when I have completely erased my ivy2 cache and run sbt clean, used a completely new copy of the activator template.

Here is the stack trace when running sbt compile

java.lang.NoSuchMethodError: me.andrz.jackson.JsonContext.<init>(Ljava/io/File;I)V
    at de.zalando.swagger.TransientJsonContext.<init>(StrictParser.scala:35)
    at de.zalando.swagger.StrictSwaggerParser.parse(StrictParser.scala:70)
    at de.zalando.swagger.SwaggerParser$.readSwaggerModel(SwaggerParser.scala:12)
    at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4$$anonfun$apply$1.apply(ApiFirstSwaggerParser.scala:55)
    at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4$$anonfun$apply$1.apply(ApiFirstSwaggerParser.scala:55)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4.apply(ApiFirstSwaggerParser.scala:55)
    at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4.apply(ApiFirstSwaggerParser.scala:55)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:235)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

HTTP response headers

I'm not clear how these work. It the spec I have the following:

      responses:
        200:
          description: Success
          headers:
            CorrelationId:
              type: string
              pattern: ^[A-Za-z0-9]{32}$

But none of the generated code allows you to return this :(

Run Your Application section ... ???

Hi,

This section is confusing me: https://github.com/zalando/api-first-hand#run-your-application.
-- How does it relate to the https://github.com/zalando/api-first-hand#building-an-api-first-hand-plugin section?
-- "Before we go any further, let's run the application" (Ln 123). Which application? The previous section "Tutorial" isn't really one; in my revision (https://github.com/LappleApple/api-first-hand/blob/master/README.md) I remove this section completely but I've saved that little bit of code. (I'm not clear on whether that code should truly reside.)
-- "The service template comes with the Swagger UI frontend included, run statically from the within Play, which provides a sandbox for your service" (Lns 129-130). What service template? It's not mentioned in the previous section, which lists some of the Template contents.
-- "The template is configured with a template Swagger API definition called example.yaml and located in the conf directory of the Play application...." this + rest of this section is framed as descriptive info. When I see a section called "Run Your Application" I expect steps and directions. So let's rework this a bit:
-- "This definition contains three end points: " there are only two bullet points. And then there are two APIs mentioned (GET /token API and POST /token API, plus the GET /todos/{user_id}. It's not clear to me if GET /todos/{user_id} is another API, or the third endpoint. Can you clarify?
-- "The token can be requested using the Swagger UI." Can we rewrite as: "use the marshaller for OAuth2 tokens, security/example.yaml.scala, to request an OAuth token with the scope admin:org; this is necessary for the client to be able to access this endpoint."
-- "Click the default button to expand the API definition in the Swagger UI." This is the only remaining/last step in the section. Are we missing any steps in between? I'm sure the endpoints/tokens info above => those steps and this will become clearer once we convert that info into true steps.

POST : Can not construct instance of de.zalando.play.controllers.ArrayWrapper

Here is the swagger.yaml

paths:
  /report:
    post:
      parameters:
        - name: biblio
          in: body
          required: true
          schema:
            description: a biblio
            type: object
            properties:
              books:
                type: array
                items:
                  type: string
      responses:
        200:
          description: Normal response, the created biblio
          schema:
            description: a biblio
            type: object
            properties:
              books:
                type: array
                items:
                  type: string

When running

curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/html' -d '{
  "books": [
    "string"
  ]
}' 'http://localhost:9000/api/report'

I have this error

! @70no256an - Internal server error, for (POST) [/api/] ->

play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[JsonMappingException: Can not construct instance of de.zalando.play.controllers.ArrayWrapper, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information
 at [Source: [B@79b686e4; line: 2, column: 12] (through reference chain: workload.yaml.ArrayPostArray["books"])]]
        at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:280)
        at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:206)
        at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:100)
        at play.core.server.netty.PlayRequestHandler$$anonfun$2$$anonfun$apply$1.applyOrElse(PlayRequestHandler.scala:99)
        at scala.concurrent.Future$$anonfun$recoverWith$1.apply(Future.scala:346)

Factorizating using allOf does not generate validators

Hi,

It's maybe related to #23, maybe not. I don't know.
Here is the problem.

I have an endpoint:

paths:
  /bars:
    post:
      operationId: postBars
      description: Bar
      parameters:
        - name: body
          in: body
          required: true
          schema:
            $ref: '#/definitions/BarsRequest'
      responses:
        200:
          description: Bar OK
          schema:
            $ref: '#/definitions/BarsResponse'

and definitions:

definitions:
  BarsRequest:
    type: object
    properties:
      state:
        type: string
        enum: ["a", "b", "c"]
      id:
        type: string
      query:
        type: string

  BarsResponse:
    type: object
    properties:
      state:
        type: string
        enum: ["a", "b", "c"]
      id:
        type: string
      bars:
        type: array
        items:
          $ref: '#/definitions/Bar'

With these definitions, the generated code is OK.

We can see that state and id are in common to BarsRequest and BarsResponse, so I created AbstractBar and used the allOf keyword:

definitions:

  AbstractBar:
    type: object
    properties:
      state:
        type: string
        enum: ["a", "b", "c"]
      id:
        type: string

  BarsRequest:
    allOf:
      - $ref: '#/definitions/AbstractBar'
      - properties:
          query:
            type: string

  BarsResponse:
    allOf:
      - $ref: '#/definitions/AbstractBar'
      - properties:
          bars:
            type: array
            items:
              $ref: '#/definitions/Bar'

But wIth these new definitions, I have the following error:

capture d ecran 2016-08-01 10 58 06

User >: Any In SwaggerSecurityExtractors

Hey guys. I was looking through the security templates and code and realized that the security extractors have the type parameters User :> Any. For example def basicAuth[User >: Any]:

I'm wondering: Is this a feature, or is this something that should be fixed?

I'd like to wrap the request with the data generated by the authentication process, through play's play.api.mvc.WrappedRequest with the WrappedRequest's type parameter being the type of the generated data.

Error when executing "sbt +publishLocal in the Api-First-Hand directory"

Dear All,

I get error when I execute the command sbt +publishLocal in the Api-First-Hand directory. I do not success to fix this error.

Could you please help me.

Here is the output of the command:

`
[info] Loading project definition from /Users/rs/api-first-hand/project

[info] Updating {file:/Users/rs/api-first-hand/project/}api-first-hand-build...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-fccfbd44c9f64523b61398a0155784d
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-buildinfo/scala_2.10/sbt_0.13/0.6.1/jars/sbt-buildinfo.jar ...
[info] [SUCCESSFUL ] com.eed3si9n#sbt-buildinfo;0.6.1!sbt-buildinfo.jar (1647ms)
[info] downloading https://repo1.maven.org/maven2/org/scoverage/sbtscoverage_2.10_0.13/1.3.5/sbt-scoverage-1.3.5.jar ...
[info] [SUCCESSFUL ] org.scoverage#sbt-scoverage;1.3.5!sbt-scoverage.jar (60ms)
[info] downloading https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/me.lessis/bintray-sbt/scala_2.10/sbt_0.13/0.2.1/jars/bintray-sbt.jar ...
[info] [SUCCESSFUL ] me.lessis#bintray-sbt;0.2.1!bintray-sbt.jar (1645ms)
[info] downloading https://repo1.maven.org/maven2/org/scalariform/sbt-scalariform_2.10_0.13/1.6.0/sbt-scalariform-1.6.0.jar ...
[info] [SUCCESSFUL ] org.scalariform#sbt-scalariform;1.6.0!sbt-scalariform.jar (51ms)
[info] downloading https://repo1.maven.org/maven2/org/brianmckenna/sbt-wartremover_2.10_0.13/0.13/sbt-wartremover-0.13.jar ...
[info] [SUCCESSFUL ] org.brianmckenna#sbt-wartremover;0.13!sbt-wartremover.jar (49ms)
[info] downloading https://repo1.maven.org/maven2/org/scalastyle/scalastyle-sbt-plugin_2.10_0.13/0.7.0/scalastyle-sbt-plugin-0.7.0.jar ...
[info] [SUCCESSFUL ] org.scalastyle#scalastyle-sbt-plugin;0.7.0!scalastyle-sbt-plugin.jar (51ms)
[info] downloading https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin/0.13.8/jars/scripted-plugin.jar ...
[info] [SUCCESSFUL ] org.scala-sbt#scripted-plugin;0.13.8!scripted-plugin.jar (1646ms)
[info] downloading https://repo1.maven.org/maven2/org/scoverage/scalac-scoverage-plugin_2.10/1.1.1/scalac-scoverage-plugin_2.10-1.1.1.jar ...
[info] [SUCCESSFUL ] org.scoverage#scalac-scoverage-plugin_2.10;1.1.1!scalac-scoverage-plugin_2.10.jar (76ms)
[info] downloading https://repo1.maven.org/maven2/me/lessis/bintry_2.10/0.4.0/bintry_2.10-0.4.0.jar ...
[info] [SUCCESSFUL ] me.lessis#bintry_2.10;0.4.0!bintry_2.10.jar (92ms)
[info] downloading https://repo1.maven.org/maven2/org/slf4j/slf4j-nop/1.7.7/slf4j-nop-1.7.7.jar ...
[info] [SUCCESSFUL ] org.slf4j#slf4j-nop;1.7.7!slf4j-nop.jar (36ms)
[info] downloading https://repo1.maven.org/maven2/net/databinder/dispatch/dispatch-json4s-native_2.10/0.11.2/dispatch-json4s-native_2.10-0.11.2.jar ...
[info] [SUCCESSFUL ] net.databinder.dispatch#dispatch-json4s-native_2.10;0.11.2!dispatch-json4s-native_2.10.jar (39ms)
[info] downloading https://repo1.maven.org/maven2/net/databinder/dispatch/dispatch-core_2.10/0.11.2/dispatch-core_2.10-0.11.2.jar ...
[info] [SUCCESSFUL ] net.databinder.dispatch#dispatch-core_2.10;0.11.2!dispatch-core_2.10.jar (61ms)
[info] downloading https://repo1.maven.org/maven2/org/json4s/json4s-native_2.10/3.2.10/json4s-native_2.10-3.2.10.jar ...
[info] [SUCCESSFUL ] org.json4s#json4s-native_2.10;3.2.10!json4s-native_2.10.jar (41ms)
[info] downloading https://repo1.maven.org/maven2/com/ning/async-http-client/1.8.10/async-http-client-1.8.10.jar ...
[info] [SUCCESSFUL ] com.ning#async-http-client;1.8.10!async-http-client.jar (82ms)
[info] downloading https://repo1.maven.org/maven2/io/netty/netty/3.9.2.Final/netty-3.9.2.Final.jar ...
[info] [SUCCESSFUL ] io.netty#netty;3.9.2.Final!netty.jar(bundle) (143ms)
[info] downloading https://repo1.maven.org/maven2/org/scala-lang/scalap/2.10.0/scalap-2.10.0.jar ...
[info] [SUCCESSFUL ] org.scala-lang#scalap;2.10.0!scalap.jar (96ms)
[info] downloading https://repo1.maven.org/maven2/org/scalariform/scalariform_2.10/0.1.8/scalariform_2.10-0.1.8.jar ...
[info] [SUCCESSFUL ] org.scalariform#scalariform_2.10;0.1.8!scalariform_2.10.jar (180ms)
[info] downloading https://repo1.maven.org/maven2/org/scalastyle/scalastyle_2.10/0.7.0/scalastyle_2.10-0.7.0.jar ...
[info] [SUCCESSFUL ] org.scalastyle#scalastyle_2.10;0.7.0!scalastyle_2.10.jar (99ms)
[info] downloading https://repo1.maven.org/maven2/com/danieltrinh/scalariform_2.10/0.1.5/scalariform_2.10-0.1.5.jar ...
[info] [SUCCESSFUL ] com.danieltrinh#scalariform_2.10;0.1.5!scalariform_2.10.jar (218ms)
[info] Done updating.
[info] Compiling 2 Scala sources to /Users/rs/api-first-hand/project/target/scala-2.10/sbt-0.13/classes...
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
[info] Set current project to api-first-hand-root (in build file:/Users/rs/api-first-hand/)
[info] Setting version to 2.10.4
[info] Reapplying settings...
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
Missing bintray credentials /Users/rs/.bintray/.credentials. Some bintray features depend on this.
[info] Set current project to api-first-hand-root (in build file:/Users/rs/api-first-hand/)
[info] Formatting 9 Scala sources {file:/Users/rs/api-first-hand/}swaggerParser(compile) ...
[info] Formatting 3 Scala sources {file:/Users/rs/api-first-hand/}swaggerModel(compile) ...
[info] Formatting 1 Scala source {file:/Users/rs/api-first-hand/}common(compile) ...
[info] Formatting 6 Scala sources {file:/Users/rs/api-first-hand/}apiFirstCore(compile) ...
[info] Formatting 12 Scala sources {file:/Users/rs/api-first-hand/}api(compile) ...
[info] Formatting 12 Scala sources {file:/Users/rs/api-first-hand/}playScalaGenerator(compile) ...
[info] Packaging /Users/rs/api-first-hand/swagger-parser/target/scala-2.10/swagger-parser_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/api-first-core/target/scala-2.10/api-first-core_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/common/target/scala-2.10/api-first-hand-common_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/swagger-model/target/scala-2.10/swagger-model_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/api/target/scala-2.10/api-first-hand-api_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/target/scala-2.10/api-first-hand-root_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/play-scala-generator/target/scala-2.10/play-scala-generator_2.10-0.2.0-sources.jar ...
[info] Done packaging.
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[info] Updating {file:/Users/rs/api-first-hand/}apiFirstCore...
[info] Resolving org.joda#joda-convert;1.7 ...
[info] Updating {file:/Users/rs/api-first-hand/}swaggerModel...
[info] Resolving org.scoverage#scalac-scoverage-plugin_2.10;1.1.1 ...
[info] Updating {file:/Users/rs/api-first-hand/}common...
[info] Resolving org.psywerx.hairyfotr#linter_2.10;0.1.12 ...
[info] Updating {file:/Users/rs/api-first-hand/}api...
[info] Updating {file:/Users/rs/api-first-hand/}root...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading https://repo1.maven.org/maven2/org/scoverage/scalac-scoverage-runtime_2.10/1.1.1/scalac-scoverage-runtime_2.10-1.1.1.jar ...
[info] [SUCCESSFUL ] org.scoverage#scalac-scoverage-runtime_2.10;1.1.1!scalac-scoverage-runtime_2.10.jar (36ms)
[info] downloading https://repo1.maven.org/maven2/org/brianmckenna/wartremover_2.10/0.13/wartremover_2.10-0.13.jar ...
[info] [SUCCESSFUL ] org.brianmckenna#wartremover_2.10;0.13!wartremover_2.10.jar (77ms)
[info] downloading https://repo1.maven.org/maven2/org/psywerx/hairyfotr/linter_2.10/0.1.12/linter_2.10-0.1.12.jar ...
[info] [SUCCESSFUL ] org.psywerx.hairyfotr#linter_2.10;0.1.12!linter_2.10.jar (141ms)
[info] Done updating.
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[info] Resolving org.scala-lang#scala-library;2.10.4 ...
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[info] Resolving org.scoverage#scalac-scoverage-runtime_2.10;1.1.1 ...
[info] Updating {file:/Users/rs/api-first-hand/}playScalaGenerator...
[info] Resolving org.brianmckenna#wartremover_2.10;0.13 ...
[info] Compiling 6 Scala sources to /Users/rs/api-first-hand/api-first-core/target/scala-2.10/classes...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Resolving com.fasterxml.jackson.module#jackson-module-scala_2.10;2.7.4 ..[info] Resolving com.fasterxml.jackson.core#jackson-annotations;2.7.4 ...
[info] Main Scala API documentation to /Users/rs/api-first-hand/api-first-core/target/scala-2.10/api...
[info] Resolving com.fasterxml.jackson.datatype#jackson-datatype-jsr310;2.7.4 ..[info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-yaml;2.7.4 [info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-csv;2.7.4 .[info] Resolving com.typesafe.play#play_2.10;2.5.4 ...
[warn] module not found: com.typesafe.play#play_2.10;2.5.4
[warn] ==== local: tried
[warn] /Users/rs/.ivy2/local/com.typesafe.play/play_2.10/2.5.4/ivys/ivy.xml
[warn] ==== activator-launcher-local: tried
[warn] /Users/rs/.activator/repository/com.typesafe.play/play_2.10/2.5.4/ivys/ivy.xml
[warn] ==== activator-local: tried
[warn] /Users/rs/activator-dist-1.3.12/repository/com.typesafe.play/play_2.10/2.5.4/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== typesafe-releases: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn] http://repo.typesafe.com/typesafe/ivy-
releases/com.typesafe.play/play_2.10/2.5.4/ivys/ivy.xml
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== typesafe-releases: tried
[warn] https://repo.typesafe.com/typesafe/releases/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/play_2.10/2.5.4/ivys/ivy.xml
[warn] ==== bintray-zalando-sbt-plugins: tried
[warn] https://dl.bintray.com/zalando/sbt-plugins/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== scalaz-bintray: tried
[warn] https://dl.bintray.com/scalaz/releases/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== zalando-maven: tried
[warn] https://dl.bintray.com/zalando/maven/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[warn] ==== jeffmay: tried
[warn] https://dl.bintray.com/jeffmay/maven/com/typesafe/play/play_2.10/2.5.4/play_2.10-2.5.4.pom
[info] Resolving com.typesafe.play#play-java-ws_2.10;2.5.4 ...
model contains 111 documentable templates
[warn] module not found: com.typesafe.play#play-java-ws_2.10;2.5.4
[warn] ==== local: tried
[warn] /Users/rs/.ivy2/local/com.typesafe.play/play-java-ws_2.10/2.5.4/ivys/ivy.xml
[warn] ==== activator-launcher-local: tried
[warn] /Users/rs/.activator/repository/com.typesafe.play/play-java-ws_2.10/2.5.4/ivys/ivy.xml
[warn] ==== activator-local: tried
[warn] /Users/rs/activator-dist-1.3.12/repository/com.typesafe.play/play-java-ws_2.10/2.5.4/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== typesafe-releases: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/play-java-ws_2.10/2.5.4/ivys/ivy.xml
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== typesafe-releases: tried
[warn] https://repo.typesafe.com/typesafe/releases/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/play-java-ws_2.10/2.5.4/ivys/ivy.xml
[warn] ==== bintray-zalando-sbt-plugins: tried
[warn] https://dl.bintray.com/zalando/sbt-plugins/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== scalaz-bintray: tried
[warn] https://dl.bintray.com/scalaz/releases/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== zalando-maven: tried
[warn] https://dl.bintray.com/zalando/maven/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[warn] ==== jeffmay: tried
[warn] https://dl.bintray.com/jeffmay/maven/com/typesafe/play/play-java-ws_2.10/2.5.4/play-java-ws_2.10-2.5.4.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.play#play_2.10;2.5.4: not found
[warn] :: com.typesafe.play#play-java-ws_2.10;2.5.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info] Resolving org.scala-lang#scala-library;2.10.4 ...
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.typesafe.play:play_2.10:2.5.4 (/Users/rs/api-first-hand/build.sbt#L28)
[warn] +- de.zalando:api-first-hand-api_2.10:0.2.0
[warn] com.typesafe.play:play-java-ws_2.10:2.5.4 (/Users/rs/api-first-hand/build.sbt#L28)
[warn] +- de.zalando:api-first-hand-api_2.10:0.2.0
[info] Resolving com.fasterxml.jackson.datatype#jackson-datatype-jsr310;2.7.4 ..[info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-yaml;2.7.4 [info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-csv;2.7.4 .[info] Resolving org.scoverage#scalac-scoverage-plugin_2.10;1.1.1 ...
[info] Main Scala API documentation successful.
[info] Packaging /Users/rs/api-first-hand/api-first-core/target/scala-2.10/api-first-core_2.10-0.2.0-javadoc.jar ...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Resolving org.slf4j#slf4j-api;1.7.10 ...
[info] Done packaging.
[info] Resolving org.slf4j#slf4j-parent;1.7.10 ...
[info] Packaging /Users/rs/api-first-hand/target/scala-2.10/api-first-hand-root_2.10-0.2.0-javadoc.jar ...
[info] Done packaging.
[info] Main Scala API documentation to /Users/rs/api-first-hand/common/target/scala-2.10/api...
model contains 6 documentable templates
[info] Main Scala API documentation successful.
[info] Compiling 1 Scala source to /Users/rs/api-first-hand/common/target/scala-2.10/classes...
[info] Packaging /Users/rs/api-first-hand/common/target/scala-2.10/api-first-hand-common_2.10-0.2.0-javadoc.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/target/scala-2.10/api-first-hand-root_2.10-0.2.0.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/common/target/scala-2.10/api-first-hand-common_2.10-0.2.0.jar ...
[info] Done packaging.
[info] Resolving com.fasterxml.jackson.module#jackson-module-scala_2.10;2.7.4 ..[info] Resolving com.fasterxml.jackson.datatype#jackson-datatype-jsr310;2.7.4 ..[info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-yaml;2.7.4 [info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-csv;2.7.4 .[info] Resolving org.scoverage#scalac-scoverage-runtime_2.10;1.1.1 ...
[info] Packaging /Users/rs/api-first-hand/api-first-core/target/scala-2.10/api-first-core_2.10-0.2.0.jar ...
[info] Resolving org.scoverage#scalac-scoverage-plugin_2.10;1.1.1 ...
[info] Done packaging.
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.10/slf4j-api-1.7.10.jar ...
[info] [SUCCESSFUL ] org.slf4j#slf4j-api;1.7.10!slf4j-api.jar (50ms)
[info] Done updating.
[info] :: delivering :: de.zalando#api-first-hand-common_2.10;0.2.0 :: 0.2.0 :: release :: Tue Dec 13 09:34:16 CET 2016
[info] delivering ivy file to /Users/rs/api-first-hand/common/target/scala-2.10/ivy-0.2.0.xml
[info] :: delivering :: de.zalando#api-first-hand-root_2.10;0.2.0 :: 0.2.0 :: release :: Tue Dec 13 09:34:16 CET 2016
[info] delivering ivy file to /Users/rs/api-first-hand/target/scala-2.10/ivy-0.2.0.xml
[info] Updating {file:/Users/rs/api-first-hand/}swaggerParser...
[info] Resolving de.zalando#beard_2.10;0.0.6 ...
[info] Compiling 3 Scala sources to /Users/rs/api-first-hand/swagger-model/target/scala-2.10/classes...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] :: delivering :: de.zalando#api-first-core_2.10;0.2.0 :: 0.2.0 :: release :: Tue Dec 13 09:34:16 CET 2016
[info] delivering ivy file to /Users/rs/api-first-hand/api-first-core/target/scala-2.10/ivy-0.2.0.xml
[info] Main Scala API documentation to /Users/rs/api-first-hand/swagger-model/target/scala-2.10/api...
[info] Resolving com.fasterxml.jackson.module#jackson-module-scala_2.10;2.7.4 ..[info] Resolving com.fasterxml.jackson.datatype#jackson-datatype-jsr310;2.7.4 ..[info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-yaml;2.7.4 [info] Resolving com.fasterxml.jackson.dataformat#jackson-dataformat-csv;2.7.4 .[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/jars/api-first-hand-root_2.10.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/jars/api-first-hand-root_2.10.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/jars/api-first-hand-root_2.10.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-hand-root_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/jars/api-first-hand-root_2.10.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/srcs/api-first-hand-root_2.10-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/srcs/api-first-hand-root_2.10-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/srcs/api-first-hand-root_2.10-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-hand-root_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/srcs/api-first-hand-root_2.10-sources.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/docs/api-first-hand-root_2.10-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/docs/api-first-hand-root_2.10-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/docs/api-first-hand-root_2.10-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-hand-root_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/docs/api-first-hand-root_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published ivy to /Users/rs/.ivy2/local/de.zalando/api-first-hand-root_2.10/0.2.0/ivys/ivy.xml
[info] :: delivering :: de.zalando#swagger-model_2.10;0.2.0 :: 0.2.0 :: release :: Tue Dec 13 09:34:17 CET 2016
[warn] Multiple resolvers having different access mechanism configured with same name 'typesafe-releases'. To avoid conflict, Remove duplicate project resolvers (resolvers) or rename publishing resolver (publishTo).
[info] delivering ivy file to /Users/rs/api-first-hand/swagger-model/target/scala-2.10/ivy-0.2.0.xml
[warn] Credentials file /Users/rs/.bintray/.credentials does not exist
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/jars/api-first-hand-common_2.10.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/jars/api-first-hand-common_2.10.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/jars/api-first-hand-common_2.10.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-hand-common_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/jars/api-first-hand-common_2.10.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/srcs/api-first-hand-common_2.10-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/srcs/api-first-hand-common_2.10-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/srcs/api-first-hand-common_2.10-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-hand-common_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/srcs/api-first-hand-common_2.10-sources.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/docs/api-first-hand-common_2.10-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/docs/api-first-hand-common_2.10-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] Main Scala API documentation to /Users/rs/api-first-hand/play-scala-generator/target/scala-2.10/api...
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/docs/api-first-hand-common_2.10-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-hand-common_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/docs/api-first-hand-common_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published ivy to /Users/rs/.ivy2/local/de.zalando/api-first-hand-common_2.10/0.2.0/ivys/ivy.xml
[info] Compiling 12 Scala sources to /Users/rs/api-first-hand/play-scala-generator/target/scala-2.10/classes...
model contains 71 documentable templates
[warn] /Users/rs/api-first-hand/swagger-model/src/main/scala/de/zalando/swagger/StrictParser.scala:76: constructor JsonParseException in class JsonParseException is deprecated: see corresponding Javadoc for more information.
[warn] throw new JsonParseException(ex.getOriginalMessage + msg, ex.getLocation)
[warn] ^
[warn] /Users/rs/api-first-hand/swagger-model/src/main/scala/de/zalando/swagger/strictModel.scala:846: constructor UnrecognizedPropertyException in class UnrecognizedPropertyException is deprecated: see corresponding Javadoc for more information.
[warn] throw new UnrecognizedPropertyException(s"Unknown property: $key", NULL, self.getClass, key, NULL)
[warn] ^
[info] Main Scala API documentation successful.
[info] Packaging /Users/rs/api-first-hand/swagger-model/target/scala-2.10/swagger-model_2.10-0.2.0-javadoc.jar ...
[info] Done packaging.
model contains 52 documentable templates
[warn] two warnings found
[info] Main Scala API documentation to /Users/rs/api-first-hand/swagger-parser/target/scala-2.10/api...
[info] Packaging /Users/rs/api-first-hand/swagger-model/target/scala-2.10/swagger-model_2.10-0.2.0.jar ...
[info] Done packaging.
[info] Compiling 9 Scala sources to /Users/rs/api-first-hand/swagger-parser/target/scala-2.10/classes...
[info] Main Scala API documentation successful.
[info] Packaging /Users/rs/api-first-hand/play-scala-generator/target/scala-2.10/play-scala-generator_2.10-0.2.0-javadoc.jar ...
[info] Done packaging.
model contains 19 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /Users/rs/api-first-hand/swagger-parser/target/scala-2.10/swagger-parser_2.10-0.2.0-javadoc.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/play-scala-generator/target/scala-2.10/play-scala-generator_2.10-0.2.0.jar ...
[info] Done packaging.
[info] Packaging /Users/rs/api-first-hand/swagger-parser/target/scala-2.10/swagger-parser_2.10-0.2.0.jar ...
[info] Done packaging.
[info] :: delivering :: de.zalando#swagger-parser_2.10;0.2.0 :: 0.2.0 :: release :: Tue Dec 13 09:34:30 CET 2016
[info] delivering ivy file to /Users/rs/api-first-hand/swagger-parser/target/scala-2.10/ivy-0.2.0.xml
[info] :: delivering :: de.zalando#play-scala-generator_2.10;0.2.0 :: 0.2.0 :: release :: Tue Dec 13 09:34:30 CET 2016
[info] delivering ivy file to /Users/rs/api-first-hand/play-scala-generator/target/scala-2.10/ivy-0.2.0.xml
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/jars/api-first-core_2.10.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/jars/api-first-core_2.10.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/jars/api-first-core_2.10.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-core_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/jars/api-first-core_2.10.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/srcs/api-first-core_2.10-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/srcs/api-first-core_2.10-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/srcs/api-first-core_2.10-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-core_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/srcs/api-first-core_2.10-sources.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/docs/api-first-core_2.10-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/docs/api-first-core_2.10-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/docs/api-first-core_2.10-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published api-first-core_2.10 to /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/docs/api-first-core_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published ivy to /Users/rs/.ivy2/local/de.zalando/api-first-core_2.10/0.2.0/ivys/ivy.xml
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/jars/play-scala-generator_2.10.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/jars/play-scala-generator_2.10.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/jars/play-scala-generator_2.10.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published play-scala-generator_2.10 to /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/jars/play-scala-generator_2.10.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/srcs/play-scala-generator_2.10-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/srcs/play-scala-generator_2.10-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/srcs/play-scala-generator_2.10-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published play-scala-generator_2.10 to /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/srcs/play-scala-generator_2.10-sources.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/docs/play-scala-generator_2.10-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/docs/play-scala-generator_2.10-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/docs/play-scala-generator_2.10-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published play-scala-generator_2.10 to /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/docs/play-scala-generator_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published ivy to /Users/rs/.ivy2/local/de.zalando/play-scala-generator_2.10/0.2.0/ivys/ivy.xml
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/jars/swagger-parser_2.10.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/jars/swagger-parser_2.10.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/jars/swagger-parser_2.10.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published swagger-parser_2.10 to /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/jars/swagger-parser_2.10.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/srcs/swagger-parser_2.10-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/srcs/swagger-parser_2.10-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/srcs/swagger-parser_2.10-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published swagger-parser_2.10 to /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/srcs/swagger-parser_2.10-sources.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/docs/swagger-parser_2.10-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/docs/swagger-parser_2.10-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/docs/swagger-parser_2.10-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published swagger-parser_2.10 to /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/docs/swagger-parser_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published ivy to /Users/rs/.ivy2/local/de.zalando/swagger-parser_2.10/0.2.0/ivys/ivy.xml
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/jars/swagger-model_2.10.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/jars/swagger-model_2.10.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/jars/swagger-model_2.10.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published swagger-model_2.10 to /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/jars/swagger-model_2.10.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/srcs/swagger-model_2.10-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/srcs/swagger-model_2.10-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/srcs/swagger-model_2.10-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published swagger-model_2.10 to /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/srcs/swagger-model_2.10-sources.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/docs/swagger-model_2.10-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/docs/swagger-model_2.10-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/docs/swagger-model_2.10-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published swagger-model_2.10 to /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/docs/swagger-model_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[info] published ivy to /Users/rs/.ivy2/local/de.zalando/swagger-model_2.10/0.2.0/ivys/ivy.xml
model contains 23 documentable templates
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/jars/sbt-api-first-hand.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/jars/sbt-api-first-hand.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/jars/sbt-api-first-hand.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/srcs/sbt-api-first-hand-sources.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/srcs/sbt-api-first-hand-sources.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/srcs/sbt-api-first-hand-sources.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/docs/sbt-api-first-hand-javadoc.jar
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/docs/sbt-api-first-hand-javadoc.jar.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/docs/sbt-api-first-hand-javadoc.jar.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/ivys/ivy.xml
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/ivys/ivy.xml.sha1
[warn] This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/rs/.ivy2/local/de.zalando/sbt-api-first-hand/scala_2.10/sbt_0.13/0.2.0/ivys/ivy.xml.md5
[warn] This usage is deprecated and will be removed in sbt 1.0.
sbt.ResolveException: unresolved dependency: com.typesafe.play#play_2.10;2.5.4: not found
unresolved dependency: com.typesafe.play#play-java-ws_2.10;2.5.4: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188)
at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
at xsbt.boot.Using$.withResource(Using.scala:10)
at xsbt.boot.Using$.apply(Using.scala:9)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
at sbt.IvySbt.withIvy(Ivy.scala:127)
at sbt.IvySbt.withIvy(Ivy.scala:124)
at sbt.IvySbt$Module.withModule(Ivy.scala:155)
at sbt.IvyActions$.updateEither(IvyActions.scala:165)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1369)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1365)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1399)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1397)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1402)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1396)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1419)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1348)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1310)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (api/*:update) sbt.ResolveException: unresolved dependency: com.typesafe.play#play_2.10;2.5.4: not found
[error] unresolved dependency: com.typesafe.play#play-java-ws_2.10;2.5.4: not found
[error] Total time: 25 s, completed 13-déc.-2016 9:34:33`

Using allOf with cross_spec doesn't generate import in model

Hi,

I have two models :

swagger: '2.0'
info:
  version: 1.0.0
paths:
definitions:
  entity:
    type: object
    properties:
      id:
        type: string
        format:  uuid
        example: "2ad91139-c3bc-420b-91a8-8aa9409aea07"
      created_at:
        type: string
        format: date-time
    required:
      - id
      - created_at

and

swagger: '2.0'
info:
  version: 1.0.0
paths:
definitions:
  point:
    allOf:
      - $ref: 'entity.yaml#/definitions/entity'

This generates two errors :
target/scala-2.11/routes/main/model/point.yaml.scala:21: not found: type DateTime
target/scala-2.11/routes/main/model/point.yaml.scala:21: not found: type UUID

As a fix, I'm adding this object to the definitions.

  import:
    description: This is only a fix for https://github.com/zalando/api-first-hand/issues/23
    type: object
    properties:
      uuid:
        type: string
        format:  uuid
      date_time:
        type: string
        format: date-time

x-api-first-handler is broken in 0.2.0 (see simple.petstore.api.yaml)

Hi,

I appreciate that apparently it's not officially out yet (?!), because I can't see version 0.2.0 in releases of this repository (#42), but I would like to bring to your attention that x-api-first-handler seems to be broken in 0.2.0, which leads to inability to compile the simple.petstore.api.yaml example.

Specifically, it seems that play-routes-compiler no longer understands that it should generate class Routes using overridden controller names, instead of autogenerated names like simple.petstore.api.yaml.Routes, and this causes compilation errors.

Many thanks!

Odd/erroneous choices for types

I'm seeing some odd types appearing in generated code.

type CalcAmount = Option[BigDecimal]

This makes sense for the field calcAmount. However, any time Option[BigDecimal] is needed, the same type is used.

expensesReceived: CalcAmount

IHMO it would be preferable to use Option[BigDecimal] as the type, than to choose these odd names.

Routing doesn't capture requests with empty required parameters

Hi,

Consider the following hello world schema:

  /welcome/{name}:
    parameters:
      - name: name
        in: path
        description: name of the user
        required: true
        type: string
        pattern: "[A-Za-z0-9]*"
      - name: last_name
        in: query
        description: last name of the user
        required: false
        type: string
        pattern: "[A-Za-z0-9]*"
    get:
      tags:
        - user
      operationId: getWelcomeByName
      description: Say welcome to name.
      responses:
        200:
          description: Return welcome message.
          schema:
            type: string
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/ErrorModel'

I would expect at least requests to /v1/welcome/ to be routed to getWelcomeByName and fail validation, because non-empty name is required and result in a BadRequest (400). The auto-generated tests seem to agree with me:

[info] GET /v1/welcome/{name}
[info] - should discard invalid data *** FAILED ***
[info]   Expected 400 but got 404
[info]   StatusCode = BAD_REQUEST
[info]   given 'Content-Type' [application/json], 'Accept' header [application/json] and URL: [/v1/welcome/?last_name=%E1%85%B1] given args: '(,Some(ᅱ))' did not equal (xxx:290)

In reality, this doesn't happen, because the pattern for parameters expects at least one character. I've patched it to require zero characters or more, and the test for the response code seems to pass, but then fails with a different problem.

I'm not sure that this is the right way to solve the problem and what additional consequences it might have otherwise, therefore I'm not making a pull request, but I will attach my patch to this issue.

Also, I would expect that requests to /v1/welcome get redirected to /v1/welcome/ if there is no handler explicitly defined to /v1/welcome (my understanding is that this is how Django routing works, for instance). Any opinions on that?

Errors when generating a new play projet using my Swagger specification

Dear all,

This is my first time that I implement a REST API using Scala and Play framework. I created the specification fo the API using swagger editor.

Then, I create a new project that I name myAPI using the command:

`$ activator new myAPI api-first-hand

Fetching the latest list of templates...

OK, application "myAPI" is being created using the "api-first-hand" template.

To run "myAPI" from the command line, "cd myAPI" then:
/Users/rs/myAPI/activator run

To run the test for "myAPI" from the command line, "cd myAPI" then:
/Users/rs/myAPI/activator test

To run the Activator UI for "myAPI" from the command line, "cd myAPI" then:
/Users/rs/myAPI/activator ui`

Afterward, I copy paste the yaml file of the specification in /conf/ and I edit the routes file as follow:

`#Routes
#This file defines all application routes (Higher priority routes first)
#~~~~

GET /spec/:name controllers.Swagger.swaggerSpec(name: String)

GET /list_specs controllers.Swagger.listSpecs

GET / controllers.Assets.versioned(path="/public/swagger", file: Asset = "index.html")

GET /index.html controllers.Assets.versioned(path="/public/swagger", file: Asset = "index.html")

GET /o2c.html controllers.Assets.versioned(path="/public/swagger", file: Asset = "o2c.html")

GET /favicon.ico controllers.Assets.versioned(path="/public/swagger/images", file: Asset = "favicon.ico")

GET /api/*file controllers.Assets.versioned(path="/public/swagger", file: Asset)

#-> /number_validation numbers.validation.yaml.Routes

#-> /string_validation string_formats.validation.yaml.Routes

#-> /cross_spec cross_spec_references.yaml.Routes

#-> /form_data form_data.yaml.Routes

#-> /types type_deduplication.yaml.Routes

#-> /uber uber.api.yaml.Routes

#-> /petstore simple.petstore.api.yaml.Routes

#-> /security security.api.yaml.Routes

#-> /example example.yaml.Routes

-> /opendataapi APISpecification.yaml.Routes`

I position my sefl in the root directory /myAPI and run the sbt command:

$ sbt [info] Loading project definition from /Users/rs/myAPI/project [info] Updating {file:/Users/rs/myAPI/project/}myapi-build... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. [info] Set current project to myAPI (in build file:/Users/rs/myAPI/)

I run the following command and I get these errors when I try to access http://localhost:9000/:

`$ run
[info] Updating {file:/Users/rs/myAPI/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[warn] Scala version was updated by one of library dependencies:
[warn] * org.scala-lang:scala-library:(2.11.7, 2.11.0, 2.11.6) -> 2.11.8
[warn] To force scalaVersion, add the following:
[warn] ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.fasterxml.jackson.module:jackson-module-scala_2.11:2.6.1 -> 2.7.4
[warn] Run 'evicted' to see detailed eviction warnings

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/rs/activator-dist-1.3.12/repository/org.slf4j/slf4j-simple/1.7.12/jars/slf4j-simple.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/rs/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[trace] Stack trace suppressed: run last compile:swaggerParseSpec for the full output.
[error] (compile:swaggerParseSpec) com.fasterxml.jackson.core.JsonParseException: Instantiation of [simple type, class de.zalando.swagger.strictModel$Schema] value failed (java.lang.IllegalArgumentException): requirement failed: Support for object definitions without properties is not implemented yet
[error] at [Source: N/A; line: -1, column: -1] (through reference chain: de.zalando.swagger.Schema["properties"]->com.fasterxml.jackson.module.scala.deser.MapBuilderWrapper["metadata"]) through reference chain: paths → /line → get → responses → 200 → schema
[trace] Stack trace suppressed: run last compile:swaggerParseSpec for the full output.
[error] (compile:swaggerParseSpec) com.fasterxml.jackson.core.JsonParseException: Instantiation of [simple type, class de.zalando.swagger.strictModel$Schema] value failed (java.lang.IllegalArgumentException): requirement failed: Support for object definitions without properties is not implemented yet
[error] at [Source: N/A; line: -1, column: -1] (through reference chain: de.zalando.swagger.Schema["properties"]->com.fasterxml.jackson.module.scala.deser.MapBuilderWrapper["metadata"]) through reference chain: paths → /line → get → responses → 200 → schema
[error] application -

! @72c4p8dcp - Internal server error, for (GET) [/] ->

play.sbt.PlayExceptions$UnexpectedException: Unexpected exception[JsonParseException: Instantiation of [simple type, class de.zalando.swagger.strictModel$Schema] value failed (java.lang.IllegalArgumentException): requirement failed: Support for object definitions without properties is not implemented yet
at [Source: N/A; line: -1, column: -1] (through reference chain: de.zalando.swagger.Schema["properties"]->com.fasterxml.jackson.module.scala.deser.MapBuilderWrapper["metadata"]) through reference chain: paths → /line → get → responses → 200 → schema]
at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:51)
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)
at scala.util.Either$LeftProjection.map(Either.scala:377)
at play.sbt.run.PlayReload$.compile(PlayReload.scala:17)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3$$anonfun$2.apply(PlayRun.scala:61)
Caused by: com.fasterxml.jackson.core.JsonParseException: Instantiation of [simple type, class de.zalando.swagger.strictModel$Schema] value failed (java.lang.IllegalArgumentException): requirement failed: Support for object definitions without properties is not implemented yet
at [Source: N/A; line: -1, column: -1] (through reference chain: de.zalando.swagger.Schema["properties"]->com.fasterxml.jackson.module.scala.deser.MapBuilderWrapper["metadata"]) through reference chain: paths → /line → get → responses → 200 → schema
at de.zalando.swagger.StrictSwaggerParser$$anonfun$1.apply(StrictParser.scala:76)
at de.zalando.swagger.StrictSwaggerParser$$anonfun$1.apply(StrictParser.scala:71)
at scala.util.control.Exception$Catch$$anon$2.apply(Exception.scala:136)
at scala.util.control.Exception$Catch$$anon$2.apply(Exception.scala:134)
at scala.util.control.Exception$Catch.apply(Exception.scala:105)
at de.zalando.swagger.StrictSwaggerParser.parse(StrictParser.scala:77)
at de.zalando.swagger.SwaggerParser$.readSwaggerModel(SwaggerParser.scala:12)
at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4$$anonfun$apply$1.apply(ApiFirstSwaggerParser.scala:55)
at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4$$anonfun$apply$1.apply(ApiFirstSwaggerParser.scala:55)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)

`

Writing ZonedDateTime

When a JSON string is written, the whole of the ZonedDateTime is written using (I think) the default toString:

"processingDate":{"offset":{"totalSeconds":0,"id":"Z","rules":{"transitions":[],"transitionRules":[],"fixedOffse...

Could I request a normal formatted date is written instead?

Type Naming of Basic Types

Hi zalando-team,

i used a swagger file of a current project to evaluate the plugin for this project. It's very awesome, but i have got a problem with the type names and i don't know how to fix it.

When i have optional basic types the plugin creates something like this:

type CompanyFinancialInstitution = Option[String] type AddressPostalCode = Option[Int] type CorrespondenceIncoming = Option[Boolean]

Now when i create another Definition with a lot of optional properties the case class looks horrible.
It would be very nice, when the Basic Optional Types would look like this or are regenerated every time for every parameter

type OptionalString = Option[String] type OptionalInt = Option[Int] type OptionalBoolean = Option[Boolean]

e.g. this snippet
TodoTask: type: object properties: guid: type: string responsible: type: string todoTaskDate: type: string format: date activity: type: string notes: type: string description: at work attachment: type: string description: at work owningCompanyGuid: type: string owningPersonGuid: type: string created: type: string format: datetime modified: type: string format: datetime

generates a horrible case class:

case class TodoTask(owningCompanyGuid: CompanyFinancialInstitution, guid: CompanyFinancialInstitution, responsible: CompanyFinancialInstitution, owningPersonGuid: CompanyFinancialInstitution, modified: CompanyFinancialInstitution, attachment: CompanyFinancialInstitution, notes: CompanyFinancialInstitution, todoTaskDate: CorrespondenceCorrespondenceDate, activity: CompanyFinancialInstitution, created: CompanyFinancialInstitution)

Greetings from South-Germany
Tobias

Custom vendor extensions lead to the parsing failure

This feature was added as a means to protect user from putting wrong extensions into the specification or to put correct extensions on the wrong place but it turns out it can break valid specification which use third-party extensions like amazon api gateway.

at de.zalando.swagger.StrictSwaggerParser$$anonfun$1.apply(StrictParser.scala:76) at de.zalando.swagger.StrictSwaggerParser$$anonfun$1.apply(StrictParser.scala:71) at scala.util.control.Exception$Catch$$anon$2.apply(Exception.scala:136) at scala.util.control.Exception$Catch$$anon$2.apply(Exception.scala:134) at scala.util.control.Exception$Catch.apply(Exception.scala:105) at de.zalando.swagger.StrictSwaggerParser.parse(StrictParser.scala:77) at de.zalando.swagger.SwaggerParser$.readSwaggerModel(SwaggerParser.scala:12) at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4$$anonfun$apply$1.apply(ApiFirstSwaggerParser.scala:55) at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4$$anonfun$apply$1.apply(ApiFirstSwaggerParser.scala:55) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) at scala.collection.AbstractTraversable.map(Traversable.scala:105) at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4.apply(ApiFirstSwaggerParser.scala:55) at de.zalando.play.swagger.sbt.ApiFirstSwaggerParser$$anonfun$swaggerParserSettings$4.apply(ApiFirstSwaggerParser.scala:55) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:235) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

add unmanaged code area for imports

when filling the methods in the generated actions, it often happens that another type has to be imported.

Allow to put this import into an unmanaged area, so it does not get removed on file-regeneration

property name seems to have to match ref name

This does not work:

      countryCode:
        "$ref": "#/definitions/countryCodes"
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "countryCode" (class des.yaml.AddressType), not marked as ignorable (6 known properties: "countryCodes", "postalCode", "addressLine1", "addressLine2", "addressLine3", "addressLine4"])
 at [Source: [B@2717a928; line: 16, column: 10] (through reference chain: des.yaml.CreateCustomerSubscription["customerCreateOrExtend"]->des.yaml.CreateCustomerSubscriptionCustomerCreateOrExtend["businessAddressDetails"]->des.yaml.AddressType["countryCode"])

But removing the plural "s" does?

      countryCode:
        "$ref": "#/definitions/countryCode"

generating models to another project

Hi,

I'm really interested on using this library but I want to have a common place where my models are defined (like another project which is used by the play api project).

Is it possible with the current functionally? or do u have a workaround for that?..

Thanks!
Lior

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.