io.swagger.v3.oas.annotations.enums.ParameterStyle Java Examples
The following examples show how to use
io.swagger.v3.oas.annotations.enums.ParameterStyle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParameterService.java From lagom-openapi with Apache License 2.0 | 6 votes |
@Operation(parameters = { @Parameter( in = ParameterIn.PATH, name = "id", required = true, description = "parameter description", allowReserved = true, style = ParameterStyle.SIMPLE, schema = @Schema( type = "string", format = "uuid", description = "the generated UUID", accessMode = Schema.AccessMode.READ_ONLY) )} ) ServiceCall<NotUsed, NotUsed> test(String id);
Example #2
Source File: PetsService.java From lagom-openapi with Apache License 2.0 | 5 votes |
@Operation( operationId = "find", description = "Returns all pets from the system that the user has access to", parameters = { @Parameter( name = "tags", description = "tags to filter by", in = QUERY, style = ParameterStyle.FORM, array = @ArraySchema(schema = @Schema(implementation = String.class)) ), @Parameter( name = "limit", description = "maximum number of results to return", in = QUERY, schema = @Schema(implementation = Integer.class) ) }, responses = { @ApiResponse( responseCode = "200", description = "pet response", content = @Content( mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = Pet.class)) ) ), @ApiResponse( description = "unexpected error", content = @Content( mediaType = "application/json", schema = @Schema(implementation = LagomError.class) ) ) } ) ServiceCall<NotUsed, List<Pet>> find(List<String> tags, Optional<Integer> limit);
Example #3
Source File: ParameterContext.java From servicecomb-toolkit with Apache License 2.0 | 4 votes |
public ParameterStyle getStyle() { return style; }
Example #4
Source File: ParameterContext.java From servicecomb-toolkit with Apache License 2.0 | 4 votes |
public void setStyle(ParameterStyle style) { this.style = style; }
Example #5
Source File: ContextTest.java From servicecomb-toolkit with Apache License 2.0 | 4 votes |
@Test public void realParameterContext() throws NoSuchMethodException { Method method = OpenapiDef.class.getDeclaredMethod("hello", String.class, Object.class); OasContext oasContext = new OasContext(null); OperationContext operationContext = new OperationContext(method, oasContext); Parameter parameter = method.getParameters()[0]; ParameterContext context = new ParameterContext(operationContext, parameter); context.setRequired(true); context.setSchema(null); assertTrue(context.isRequired()); context.setDefaultValue("default"); context.setIn(InType.QUERY); context.setName("param1"); context.setDescription("desc"); context.setStyle(ParameterStyle.SIMPLE); context.addExtension("extension-key", "extension-value"); assertFalse(context.isRequestBody()); context.toParameter(); context.applyAnnotations(Collections.emptyList()); assertEquals("param1", context.getName()); assertEquals(InType.QUERY, context.getIn()); assertEquals(String.class, context.getRealType()); assertEquals(String.class, context.getType()); assertEquals(operationContext.getComponents(), context.getComponents()); assertEquals(operationContext, context.getOperationContext()); assertNull(context.getExtensions()); assertNotNull(context.getOasParameter()); assertNull(context.getParser()); assertEquals(parameter, context.getParameter()); assertNotNull(context.getSchema()); assertEquals("default", context.getDefaultValue()); assertEquals("desc", context.getDescription()); assertEquals(ParameterStyle.SIMPLE, context.getStyle()); assertFalse(context.isRequired()); assertNull(context.getDeprecated()); context.setIn(InType.COOKIE); assertFalse(context.isRequestBody()); context.toParameter(); context.setIn(InType.HEADER); assertFalse(context.isRequestBody()); context.toParameter(); context.setIn(InType.PATH); assertFalse(context.isRequestBody()); context.toParameter(); context.setIn(InType.FORM); assertTrue(context.isRequestBody()); context.toParameter(); context.setIn(InType.BODY); context.toParameter(); assertTrue(context.isRequestBody()); context.addConsume(MediaTypes.APPLICATION_JSON); assertEquals(MediaTypes.APPLICATION_JSON, context.getConsumers().get(0)); context.setRequestBody(new RequestBody()); assertNotNull(context.getRequestBody()); }