Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
feat(rest): add request parameter name, type and transitive to docume…
Browse files Browse the repository at this point in the history
…ntation
  • Loading branch information
maierthomas committed Feb 22, 2018
1 parent eaafaf4 commit 0ad21e9
Show file tree
Hide file tree
Showing 12 changed files with 401 additions and 37 deletions.
6 changes: 3 additions & 3 deletions rest/resource-server/src/docs/asciidoc/api-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Siemens AG, 2017. Part of the SW360 Portal Project.
// Copyright Siemens AG, 2017-2018. Part of the SW360 Portal Project.
//
// All rights reserved. This configuration file is provided to you under the
// terms and conditions of the Eclipse Distribution License v1.0 which
Expand Down Expand Up @@ -181,7 +181,7 @@ Token response elements
|===

[[token-jwt]]
=== JSON Web Tokens (JWT.IO)
=== JSON Web Tokens

http://jwt.io[JWT.IO] allows you to decode and verify your sw360 authorization token.

Expand Down Expand Up @@ -265,4 +265,4 @@ include::releases.adoc[]
include::attachments.adoc[]
include::vendors.adoc[]
include::licenses.adoc[]
include::vulnerabilites.adoc[]
include::vulnerabilities.adoc[]
45 changes: 44 additions & 1 deletion rest/resource-server/src/docs/asciidoc/components.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Siemens AG, 2017. Part of the SW360 Portal Project.
// Copyright Siemens AG, 2017-2018. Part of the SW360 Portal Project.
//
// All rights reserved. This configuration file is provided to you under the
// terms and conditions of the Eclipse Distribution License v1.0 which
Expand Down Expand Up @@ -34,6 +34,49 @@ include::{snippets}/should_document_get_components/http-response.adoc[]

include::{snippets}/should_document_get_components/links.adoc[]

[[resources-components-list-by-name]]
==== Listing by name

A `GET` request will list all of the service's components by component name.

===== Response structure

include::{snippets}/should_document_get_components_by_name/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_components_by_name/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_components_by_name/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_components_by_name/links.adoc[]

[[resources-components-list-by-type]]
==== Listing by type

A `GET` request will list all of the service's components by component type. +
Component types = `{INTERNAL, OSS, COTS, FREESOFTWARE, INNER_SOURCE, SERVICE}`

===== Response structure

include::{snippets}/should_document_get_components_by_type/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_components_by_type/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_components_by_type/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_components_by_type/links.adoc[]

[[resources-component-get]]
==== Get a single component

Expand Down
112 changes: 110 additions & 2 deletions rest/resource-server/src/docs/asciidoc/projects.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright Siemens AG, 2017. Part of the SW360 Portal Project.
// Copyright Siemens AG, 2017-2018. Part of the SW360 Portal Project.
//
// All rights reserved. This configuration file is provided to you under the
// terms and conditions of the Eclipse Distribution License v1.0 which
Expand Down Expand Up @@ -34,6 +34,50 @@ include::{snippets}/should_document_get_projects/http-response.adoc[]

include::{snippets}/should_document_get_projects/links.adoc[]

[[resources-projects-list-by-name]]
==== Listing by name

A `GET` request will list all of the service's projects by project name.

===== Response structure

include::{snippets}/should_document_get_projects_by_name/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_projects_by_name/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_projects_by_name/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_projects_by_name/links.adoc[]

[[resources-projects-list-by-type]]
==== Listing by type

A `GET` request will list all of the service's projects by project type. +
Project types = `{CUSTOMER, INTERNAL, PRODUCT, SERVICE, INNER_SOURCE}`

===== Response structure

include::{snippets}/should_document_get_projects_by_type/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_projects_by_type/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_projects_by_type/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_projects_by_type/links.adoc[]


[[resources-project-get]]
==== Get a single project

Expand All @@ -55,6 +99,71 @@ include::{snippets}/should_document_get_project/http-response.adoc[]

include::{snippets}/should_document_get_project/links.adoc[]

[[resources-project-get-project-releases]]
==== Listing releases

A `GET` request will get releases of a single project. +
Only linked releases without any releases of sub-projects (&transitive=false).

===== Response structure

include::{snippets}/should_document_get_project_releases/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_project_releases/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_project_releases/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_project_releases/links.adoc[]

[[resources-project-get-project-releases-transitive]]
==== Listing releases (transitive)

A `GET` request will get all releases of a single project (transitive). +
Please set the request parameter (&transitive=true).

===== Response structure

include::{snippets}/should_document_get_project_releases_transitive/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_project_releases_transitive/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_project_releases_transitive/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_project_releases_transitive/links.adoc[]

[[resources-project-get-project-releases-ecc-information]]
==== Listing releases with ECC

A `GET` request will get all releases with ECC information of a single project.
This works also with the transitive request parameter (&transitive=true)

===== Response structure

include::{snippets}/should_document_get_project_releases_ecc_information/response-fields.adoc[]

===== Example request

include::{snippets}/should_document_get_project_releases_ecc_information/curl-request.adoc[]

===== Example response

include::{snippets}/should_document_get_project_releases_ecc_information/http-response.adoc[]

===== Links

include::{snippets}/should_document_get_project_releases_ecc_information/links.adoc[]

////
[[resources-projects-create]]
Expand All @@ -74,4 +183,3 @@ include::{snippets}/should_document_create_project/curl-request.adoc[]
include::{snippets}/should_document_create_project/http-response.adoc[]
////

Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public ResponseEntity<Resources<Resource<Component>>> getComponents(@RequestPara
c.setCreatedOn(null);
c.setVendorNames(null);
c.setReleaseIds(null);
c.setComponentOwner(null);
componentResources.add(new Resource<>(c));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public ResponseEntity<Resources<Resource>> getReleasesForUser(@RequestParam(valu
release.setReleaseDate(null);
release.setVendor(null);
release.setMainLicenseIds(null);
release.setExternalIds(null);
release.setCreatedOn(null);
release.setCpeid(null);
Resource<Release> releaseResource = new Resource<>(release);
releaseResources.add(releaseResource);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright Bosch Software Innovations GmbH, 2017.
* With modifications by Siemens AG, 2018.
* Part of the SW360 Portal Project.
*
* SPDX-License-Identifier: EPL-1.0
Expand All @@ -11,24 +12,13 @@
*/
package org.eclipse.sw360.rest.resourceserver.vulnerability;

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.sw360.datahandler.common.SW360Constants;
import org.eclipse.sw360.datahandler.thrift.ProjectReleaseRelationship;
import org.eclipse.sw360.datahandler.thrift.ReleaseRelationship;
import org.eclipse.sw360.datahandler.thrift.components.Component;
import org.eclipse.sw360.datahandler.thrift.projects.Project;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.sw360.datahandler.thrift.users.User;
import org.eclipse.sw360.datahandler.thrift.vulnerabilities.Vulnerability;
import org.eclipse.sw360.rest.resourceserver.core.HalResource;
import org.eclipse.sw360.rest.resourceserver.core.RestControllerHelper;
import org.eclipse.sw360.rest.resourceserver.project.ProjectController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.BasePathAwareController;
import org.springframework.data.rest.webmvc.RepositoryLinksResource;
Expand All @@ -41,9 +31,10 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.List;

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;

@BasePathAwareController
@Slf4j
Expand All @@ -64,6 +55,9 @@ public ResponseEntity<Resources<Resource<Vulnerability>>> getVulnerabilities(OAu

List<Resource<Vulnerability>> vulnerabilityResources = new ArrayList<>();
for (Vulnerability vulnerability : vulnerabilities) {
vulnerability.setCwe(null);
vulnerability.setId(null);
vulnerability.setExternalId(null);
Resource<Vulnerability> vulnerabilityResource = new Resource<>(vulnerability);
vulnerabilityResources.add(vulnerabilityResource);
}
Expand Down
Loading

0 comments on commit 0ad21e9

Please sign in to comment.