private RefModel toRefModel(String modelType) { if (RefProperty.class.isInstance(property)) { return (RefModel) PropertyBuilder.toModel(property); } ModelImpl modelImpl = new ModelImpl(); modelImpl.setType("object"); modelImpl.setName(name); modelImpl.addProperty(name, property); operationGenerator.getSwagger().addDefinition(modelType, modelImpl); RefModel refModel = new RefModel(); refModel.setReference("#/definitions/" + modelType); return refModel; } }
private Parameter replaceArrayModelForOctetStream(Operation operation, Parameter parameter) { if (parameter instanceof BodyParameter && operation.getConsumes() != null && operation.getConsumes().contains("application/octet-stream")) { BodyParameter bodyParam = (BodyParameter) parameter; Model schema = bodyParam.getSchema(); if (schema instanceof ArrayModel) { ArrayModel arrayModel = (ArrayModel) schema; Property items = arrayModel.getItems(); if (items != null && items.getFormat() == "byte" && items.getType() == "string") { ModelImpl model = new ModelImpl(); model.setFormat("byte"); model.setType("string"); bodyParam.setSchema(model); } } } return parameter; }
@Override public Model getUPDATEModel(Representation rep) { return new ModelImpl() .property("description", new StringProperty()); }
/** * Create a default Model for a failed PropertyBox type resolution. * @return The default unresolved schema */ private static Model buildUnresolvedPropertyBoxSchema() { final ModelImpl model = new ModelImpl(); model.setType(ModelImpl.OBJECT); model.setTitle("PropertyBox"); return model; }
@Override public Model getUPDATEModel(Representation representation) { return new ModelImpl() .property("name", new StringProperty()); //FIXME missing props }
/** * Get the model actual resolution to the {@link SwaggerV2ApiExtension}. * @return Delgate resolution model */ private static Model delegateToExtensionResolution() { final ModelImpl model = new ModelImpl(); model.setType(ModelImpl.OBJECT); model.setTitle("PropertyBox"); model.setVendorExtension(SwaggerExtensions.MODEL_TYPE.getExtensionName(), PropertyBox.class.getName()); return model; }
protected Parameter generateQueryPostOpParam(List<RestQueriesConfiguration.QueryParamInfo> params) { Map<String, Property> modelProps = params.stream() .collect(Collectors.toMap( RestQueriesConfiguration.QueryParamInfo::getName, p -> getPropertyFromJavaType(p.getType()))); ModelImpl parameterModel = new ModelImpl(); parameterModel.setProperties(modelProps); BodyParameter parameter = new BodyParameter() .name("paramsObject"); parameter.setRequired(true); return parameter.schema(parameterModel); }
private BodyParameter getDefaultBodyParameter() { BodyParameter bodyParameter = new BodyParameter(); bodyParameter.setName("Payload"); bodyParameter.setDescription("Request Body"); bodyParameter.setRequired(false); Model model = new ModelImpl(); Map<String, Property> properties = new HashMap<>(); Property property = new StringProperty(); properties.put("payload", property); model.setProperties(properties); bodyParameter.setSchema(model); return bodyParameter; }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("patientUuid", new StringProperty()) .property("startDate", new DateProperty()) .property("endDate", new DateProperty()); }
@Override public Model getCREATEModel(Representation rep) { ModelImpl model = new ModelImpl() .property("patient", new StringProperty().example("uuid")) .required("patient"); if (rep instanceof FullRepresentation) { model .property("patient", new RefProperty("#/definitions/PatientCreate")); } return model; }
@Override public Model getCREATEModel(Representation representation) { return new ModelImpl() .property("conceptReferenceTerm", new RefProperty("#/definitions/ConceptreferencetermCreate")) .property("conceptMapType", new RefProperty("#/definitions/ConceptmaptypeCreate")) .required("conceptReferenceTerm").required("conceptMapType"); }
@Override public Model getCREATEModel(Representation representation) { return new ModelImpl() .property("description", new StringProperty()) .property("locale", new StringProperty().example("fr")) .required("description").required("locale"); }
@Override public Model getCREATEModel(Representation rep) { ModelImpl model = new ModelImpl(); model.property("tasks", new ArrayProperty(new StringProperty())); model.property("allTasks", new BooleanProperty()); model.property("action", new EnumProperty(TaskAction.Action.class)); model.required("action"); return model; }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("ingredient", new StringProperty().example("uuid")) .property("strength", new DoubleProperty()) .property("units", new StringProperty().example("uuid")) .required("ingredient"); }
@Override public Model getUPDATEModel(Representation representation) { return new ModelImpl() .property("name", new RefProperty("#/definitions/ConceptNameCreate")) .property("names", new ArrayProperty(new RefProperty("#/definitions/ConceptNameCreate"))) .property("descriptions", new ArrayProperty(new RefProperty("#/definitions/ConceptDescriptionCreate"))); }
@Override public Model getUPDATEModel(Representation rep) { return new ModelImpl() .property("description", new StringProperty()) .property("privileges", new ArrayProperty(new RefProperty("#/definitions/PrivilegeCreate"))) .property("inheritedRoles", new ArrayProperty(new RefProperty("#/definitions/RoleCreate"))); }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("orderType", new ObjectProperty() .property("uuid", new StringProperty())) .property("orderTemplate", new StringProperty()) .property("concept", new StringProperty().example("uuid")) .property("retired", new BooleanProperty()); }
@Override public Model getCREATEModel(Representation rep) { ModelImpl model = new ModelImpl() .property("person", new StringProperty().example("uuid")) .property("identifiers", new ArrayProperty(new RefProperty("#/definitions/PatientIdentifierCreate"))) .required("person").required("identifiers"); if (rep instanceof FullRepresentation) { model .property("person", new RefProperty("#/definitions/PersonCreate")); } return model; }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("name", new StringProperty()) .property("description", new StringProperty()) .property("memberIds", new ArrayProperty(new IntegerProperty())) //FIXME .required("name").required("description").required("memberIds"); }
@Override public Model getCREATEModel(Representation rep) { return new ModelImpl() .property("patient", new StringProperty().example("uuid")) .property("concept", new StringProperty().example("uuid")) .property("startDate", new DateProperty()) .property("autoExpireDate", new DateProperty()) .property("standardRegimenCode", new StringProperty()) .property("instructions", new StringProperty()) .required("patient").required("concept"); }