Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Parameter format byte breaks generation #20

Closed
nmcb opened this issue Oct 13, 2015 · 5 comments
Closed

Parameter format byte breaks generation #20

nmcb opened this issue Oct 13, 2015 · 5 comments
Labels
Milestone

Comments

@nmcb
Copy link
Contributor

nmcb commented Oct 13, 2015

The parameter format: byte for type: string breaks generation.

API definition:


---
swagger: '2.0'
x-api-first-package: controllers
info:
  version: 0.0.0
  title: Simple API Test
paths:
  /{bippy}:
    get:
      parameters:
        - in: path
          name: bippy
          type: string
          format: byte
          # path parameter required as a workaround for issue 5 
          required: true
      responses:
        200:
          description: bippy response
# model definition required as a workaround for issue 18          
definitions:
  bop:
    properties:
      name:
        type: string

Compilation:

[play-swagger-test] $ compile
[info] Updating {file:/Users/marco/Code/play-swagger-test/}root...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 17 Scala sources and 1 Java source to /Users/marco/Code/play-swagger-test/target/scala-2.11/classes...
[error] /Users/marco/Code/play-swagger-test/conf/bippy.yaml:0: No URL path binder found for type Byte. Try to implement an implicit PathBindable for this type.
[error] /Users/marco/Code/play-swagger-test/conf/bippy.yaml:0: not enough arguments for method fromPath: (implicit binder: play.api.mvc.PathBindable[Byte])play.core.routing.Param[Byte].
[error] Unspecified value parameter binder.
[error] /Users/marco/Code/play-swagger-test/conf/bippy.yaml:0: No URL path binder found for type Byte. Try to implement an implicit PathBindable for this type.
[error] /Users/marco/Code/play-swagger-test/conf/bippy.yaml:0: not enough arguments for method implicitly: (implicit e: play.api.mvc.PathBindable[Byte])play.api.mvc.PathBindable[Byte].
[error] Unspecified value parameter e.
[error] /Users/marco/Code/play-swagger-test/conf/bippy.yaml:0: No URL path binder found for type Byte. Try to implement an implicit PathBindable for this type.
[error] /Users/marco/Code/play-swagger-test/conf/bippy.yaml:0: not enough arguments for method implicitly: (implicit e: play.api.mvc.PathBindable[Byte])play.api.mvc.PathBindable[Byte].
[error] Unspecified value parameter e.
[error] 6 errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 4 s, completed Oct 13, 2015 7:19:49 PM
@slavaschmidt
Copy link
Contributor

Following format are not supported:
format: binary, type: string any sequence of octets
Following format is supported but incorrect:
format: byte, type:string
Should be: base64 encoded characters
Handled as: Numeric byte type

@slavaschmidt slavaschmidt added this to the 0.1.6 milestone Feb 18, 2016
@slavaschmidt
Copy link
Contributor

One relevant discussion can be seen here:

OAI/OpenAPI-Specification#50

@slavaschmidt
Copy link
Contributor

For now, it seems like type binary is only supposed too be supported as body parameter.
We could use mime type application/octet-stream as a marker that body must be encoded or decoded as a binary type.
For bytewe probably need to define appropriate mime type to recognise it as a body parameter. For path, query and header parameters there should be no problems with encoding and decoding.

@slavaschmidt
Copy link
Contributor

Code generation is not broken anymore. Support for byteformat is added and tested. Support for binaryformat is added but not well tested. The question is: do we need a special mime type to distinguish it or do we use something else?

slavaschmidt added a commit that referenced this issue Feb 21, 2016
slavaschmidt added a commit that referenced this issue Feb 21, 2016
@slavaschmidt
Copy link
Contributor

Released in 0.1.6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants