private static Collection<QueryParameter> transformMappings(final Iterable<SearchMapping> searchMappings) { // NOSONAR return StreamSupport.stream(searchMappings.spliterator(), false) .map(m -> new QueryParameter().name(m.getAlias()).type("string").description(m.getDescription())) .collect(toList()); } }
private List<Parameter> buildPagingParameters() { List<Parameter> params = new ArrayList<Parameter>(); Parameter limit = new QueryParameter().name("limit") .description("The number of results to return").type("integer"); Parameter startIndex = new QueryParameter().name("startIndex") .description("The offset at which to start").type("integer"); params.add(limit); params.add(startIndex); return params; }
/** * @return the JSON-API 'sort' query parameter for some GET operations. */ private Parameter getSortParameter() { List<String> filterAttributes = dictionary.getAttributes(type).stream() .filter((name) -> { Class<?> attributeClass = dictionary.getType(type, name); return (attributeClass.isPrimitive() || String.class.isAssignableFrom(attributeClass)); }) .map((name) -> Arrays.asList(name, "-" + name)) .flatMap(Collection::stream) .collect(Collectors.toList()); return new QueryParameter() .name("sort") .type("array") .description("Sorts the collection on the selected attributes. A prefix of '-' sorts descending") .items(new StringProperty()._enum(filterAttributes)) .collectionFormat("csv"); }
.description("Number of pages to return. Can be used with page[size]") .type("integer") ); .description("Number of elements per page. Can be used with page[number]") .type("integer") ); .description("Offset from 0 to start paginating. Can be used with page[limit]") .type("integer") ); .description("Maximum number of items to return. Can be used with page[offset]") .type("integer") ); .description("For requesting total pages/records be included in the response page meta data")
.type("string") .name("filter[" + typeName + "]") .description("Filters the collection of " + typeName + " using a 'disjoint' RSQL expression")); .type("string") .name("filter") .description("Filters the collection of " + typeName + " using a 'joined' RSQL expression")); .type("string") .name("filter[" + typeName + "." + name + "][" + op.getNotation() + "]") .description("Filters the collection of " + typeName + " by the attribute " + name + " " + "using the operator " + op.getNotation()));
new QueryParameter() .name("dynamicAttributes") .description("Specifies whether entity dynamic attributes should be returned.") .property(new BooleanProperty()), new QueryParameter() .name("returnCount") .description("Specifies whether the total count of entities should be returned in the " + "'X-Total-Count' header.") .property(new BooleanProperty()), new QueryParameter() .name("returnNulls") .description("Specifies whether null fields will be written to the result JSON.") .property(new BooleanProperty()), new QueryParameter() .name("view") .description("Name of the view which is used for loading the entity. Specify this parameter " + "if you want to extract entities with the view other than it is defined in the REST " + "queries configuration file.") new QueryParameter() .name("offset") .description("Position of the first result to retrieve.") .property(new StringProperty()), new QueryParameter() .name("limit") .description("Number of extracted entities.") .property(new StringProperty()) );
new QueryParameter() .name("dynamicAttributes") .description("Specifies whether entity dynamic attributes should be returned.") .property(new BooleanProperty()), new QueryParameter() .name("returnNulls") .description("Specifies whether null fields will be written to the result JSON.") .property(new BooleanProperty()), new QueryParameter() .name("view") .description("Name of the view which is used for loading the entity.") .property(new StringProperty()) ); new QueryParameter() .name("returnCount") .description("Specifies whether the total count of entities should be returned in the " + "'X-Total-Count' header.") .property(new BooleanProperty()), new QueryParameter() .name("offset") .description("Position of the first result to retrieve.") .property(new StringProperty()), new QueryParameter() .name("limit") .description("Number of extracted entities.") .property(new StringProperty()), new QueryParameter() .name("sort")
/** * @return the JSON-API 'include' query parameter for some GET operations. */ private Parameter getIncludeParameter() { List<String> relationshipNames = dictionary.getRelationships(type); return new QueryParameter() .type("array") .name("include") .description("Selects the set of relationships that should be expanded as a compound document in " + "the result.") .items(new StringProperty()._enum(relationshipNames)) .collectionFormat("csv"); }
/** * Build a {@link QueryParameter} Swagger object defined by {@link ApiImplicitParam} * to use for documentation. * * @param apiParam The annotation which documents the parameter. * @return The {@link QueryParameter} object to be used in {@link Swagger} */ public static QueryParameter queryParameter(ApiImplicitParam apiParam) { return new QueryParameter() .name(apiParam.name()) .description(apiParam.value()) .required(apiParam.required()) .type(apiParam.dataType()); }
/** * @return the JSON-API 'field' query parameter for some GET operations. */ private Parameter getSparseFieldsParameter() { String typeName = dictionary.getJsonAliasFor(type); List<String> fieldNames = dictionary.getAllFields(type); return new QueryParameter() .type("array") .name("fields[" + typeName + "]") .description("Selects the set of " + typeName + " fields that should be returned in the result.") .items(new StringProperty()._enum(fieldNames)) .collectionFormat("csv"); }
final QueryParameter param = new QueryParameter().type(type).name(paramName); if (annotation != null) { param.description(annotation.value());
final QueryParameter param = new QueryParameter().type(type).name(paramName); if (annotation != null) { param.description(annotation.value());
.description("The search query") .type("string"); .description("The representation to return (ref, default, full or custom)") .type("string") ._enum(Arrays.asList("ref", "default", "full", "custom"));
.description(QUERY_PARAM_VALUE) .required(true) .type(SwaggerDocumentation.DataTypes.DATA_TYPE_STRING);
.description("The representation to return (ref, default, full or custom)") .type("string") ._enum(Arrays.asList("ref", "default", "full", "custom"));