opencb / cellbase

High-Performance NoSQL database and RESTful web services to access to most relevant biological data
Apache License 2.0
89 stars 53 forks source link

REST API: clean up for consistency #522

Open julie-sullivan opened 4 years ago

julie-sullivan commented 4 years ago

Some of these are for discussion:

julie-sullivan commented 4 years ago

There are several classes that don't seem to be in use:

Can we delete? If we need to restore we can revive via git.

julie-sullivan commented 4 years ago
Caused by: java.lang.NumberFormatException: For input string: "a"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.valueOf(Integer.java:766)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.internal.inject.PrimitiveValueOfExtractor.getValue(PrimitiveValueOfExtractor.java:74)
    at org.glassfish.jersey.server.internal.inject.PrimitiveValueOfExtractor.extract(PrimitiveValueOfExtractor.java:91)
    at org.glassfish.jersey.server.internal.inject.QueryParamValueParamProvider$QueryParamValueProvider.apply(QueryParamValueParamProvider.java:78)
    ... 72 more
julie-sullivan commented 4 years ago

Instead of " Please note that this parameter may not be enabled for all web services." only have valid web services for each end point.

This will cause duplication in the code however.

julie-sullivan commented 4 years ago

http://bioinfo.hpc.cam.ac.uk/cellbase/webservices/#!/TFBS/getAllByTfbs

I'm having trouble with the cellType parameter.

julie-sullivan commented 4 years ago
param /info /search "redundant" path queries, e.g. gene/{id}/protein distinct queries /model /sequence
exclude/include/sort - - -
count - - - -
limit,skip - - - -
julie-sullivan commented 4 years ago

If I include fields and don't explicitly mention id I get a null pointer exception:

2020-02-10 11:31:03 [qtp1127224355-9] INFO  connection:71 - Opened connection [connectionId{localValue:12, serverValue:2728}] to localhost:27017
java.lang.NullPointerException
    at org.opencb.cellbase.server.rest.feature.IdWSServer.getByFeatureIdInfo(IdWSServer.java:99)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

id is assumed to be present:

            List<CellBaseDataResult<Document>> dbNameList = xRefDBAdaptor.nativeGet(queries, queryOptions);
            for (int i = 0; i < dbNameList.size(); i++) {
                dbNameList.get(i).setId(list.get(i));
                for (Document document : dbNameList.get(i).getResults()) {
                    if (document.get("id").equals(list.get(i))) {

Therefore I removed include as the user shouldn't be changing this. See 1eddb9213b3d038c854f5afe730c638c68ef95fb

julie-sullivan commented 4 years ago

The API description parameter is deprecated.

If you set the description properly using tags, it shows up in swagger like:

api-description

I think it makes the API harder to read.

@SwaggerDefinition(tags = {
        @Tag(name = "Species", description = "Species RESTful Web Services API")
}