Skip to content

Commit

Permalink
Try to support form arguments (#11)
Browse files Browse the repository at this point in the history
Not sure if they are expressed correctly in the OpenAPI output. It
validates on editor.swagger.io, so maybe...
  • Loading branch information
jskov-jyskebank-dk committed Aug 29, 2019
1 parent 5279d12 commit a3d5c5c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class Param {
typeLabel2in.put(MATRIX, PATH);
typeLabel2in.put(PATH, PATH);
typeLabel2in.put(QUERY, QUERY);
typeLabel2in.put(FORM, QUERY);
}

private static final Map<String, String> typeLabel2style = new HashMap<>();
Expand All @@ -57,6 +58,7 @@ public class Param {
typeLabel2style.put(MATRIX, MATRIX);
typeLabel2style.put(PATH, SIMPLE);
typeLabel2style.put(QUERY, FORM);
typeLabel2style.put(FORM, FORM);
}

public Param(EnunciateLogger logger, DataTypeReferenceRenderer dataTypeReferenceRenderer, ObjectTypeRenderer objectTypeRenderer, Parameter parameter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.PUT;
Expand Down Expand Up @@ -60,6 +61,13 @@ public Response withMatrixParams(@MatrixParam("id") List<Long> ids) {
return dummyResult();
}

@PUT
@Produces(MediaType.TEXT_PLAIN)
@Path("form")
public Response formParam(@FormParam("name") String name) {
return dummyResult();
}

// @Path("/bytearray-input")
// @PUT
// @Produces(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,30 @@ paths:
schema:
type: string

"/path/form":
put:
description: ""
tags:
- "DataResource"
summary: ""
deprecated: false
operationId: formParam
parameters:
- name: "name"
in: query
description: ""
required: false
schema:
type: string
style: form
responses:
"204":
description: ""
content:
"*/*":
schema:
type: string

"/path/inputStream":
put:
description: ""
Expand Down

0 comments on commit a3d5c5c

Please sign in to comment.