plantbreeding / brapi-Java-TestServer

BrAPI Java Spring-Boot Test Server
https://brapi.org
MIT License
5 stars 7 forks source link

Errors with POST Germplasm endpoint #40

Closed ctucker3 closed 3 years ago

ctucker3 commented 4 years ago

Below are descriptions for errors in the POST germplasm endpoint. Quick summary, there seems to be issues with the germplasmOrigin and storageTypes fields and the donors, institute code, institute name, synonyms, or taxons do not cause errors, but are not saved properly.

I'm doing POST germplasm to the brapi test server and it errors out when I include a germplasmOrigin in there. Here is the body I am sending,

[
    {
        "accessionNumber": "A0000001",
        "acquisitionDate": "2000-04-09",
        "additionalInfo": {
          "dummyData": "True"
        },
        "biologicalStatusOfAccessionCode": "120",
        "biologicalStatusOfAccessionDescription": "Semi-natural/wild",
        "breedingMethodDbId": "breeding_method1",
        "collection": "Fake Foods Collection",
        "commonCropName": "Tomatillo",
        "countryOfOriginCode": "USA",
        "defaultDisplayName": "Fantastico",
        "documentationURL": "https://wiki.brapi.org",
        "donors": [
          {
            "donorAccessionNumber": "A1111111",
            "donorInstituteCode": "USA999",
            "germplasmPUI": "doi:10.12345/A1111111"
          }
        ],
        "externalReferences": [
          {
            "referenceID": "https://brapi.org/specification",
            "referenceSource": "BrAPI Doc"
          }
        ],
        "genus": "Aspergillus",
        "germplasmName": "Tomatillo Fantastico",
        "germplasmOrigin": [
          {
            "coordinateUncertainty": "20",
            "coordinates": {
              "geometry": {
                "coordinates": [
                  42.535140,
                  -76.554040,
                  123.099800
                ],
                "type": "Point"
              },
              "type": "Feature"
            }
          }
        ],
        "germplasmPUI": "doi:10.12345/A0000001",
        "germplasmPreprocessing": "EO:0007210; transplanted from study 2351 observation unit ID: pot:894",
        "instituteCode": "USA999",
        "instituteName": "BrAPI Science Institute",
        "pedigree": "A2342345/A1231234",
        "seedSource": "Root Stock",
        "seedSourceDescription": "Branches were collected from a 10-year-old tree growing in a progeny trial established in a loamy brown earth soil.",
        "species": "fructus",
        "speciesAuthority": "Smith, 1822",
        "storageTypes": [
          {
            "value": "10",
            "description": "Seed collection"
          }
        ],
        "subtaxa": "Aspergillus fructus A",
        "subtaxaAuthority": "Smith, 1822",
        "synonyms": [
          {
            "synonym": "Variety 123",
            "type": "Pre-Code"
          }
        ],
        "taxonIds": [
          {
            "sourceName": "NCBI",
            "taxonId": "2026747"
          }
        ]
        }
]

Here is the error I am getting:

{
  "timestamp": 1600345699155,
  "status": 500,
  "error": "Internal Server Error",
  "message": "Type definition error: [simple type, class io.swagger.model.GeoJSONGeometry]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `io.swagger.model.GeoJSONGeometry` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information\n at [Source: (PushbackInputStream); line: 35, column: 27] (through reference chain: java.util.ArrayList[0]->io.swagger.model.germ.GermplasmNewRequest[\"germplasmOrigin\"]->java.util.ArrayList[0]->io.swagger.model.germ.GermplasmOrigin[\"coordinates\"]->io.swagger.model.GeoJSON[\"geometry\"])",
  "path": "/brapi/v2/germplasm"
}

When I remove germplasmOrigin I get an error about storageTypes:

{
  "timestamp": 1600345988841,
  "status": 500,
  "error": "Internal Server Error",
  "message": "Type definition error: [simple type, class io.swagger.model.germ.GermplasmStorageTypes]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `io.swagger.model.germ.GermplasmStorageTypes` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (PushbackInputStream); line: 42, column: 13] (through reference chain: java.util.ArrayList[0]->io.swagger.model.germ.GermplasmNewRequest[\"storageTypes\"]->java.util.ArrayList[0])",
  "path": "/brapi/v2/germplasm"
}

Removed storageTypes and it works

Also, when you POST and you have donors, institute code, institute name, synonyms, or taxons populated, it doesn't seem to save those fields. It will return them in the POST response but if you GET that specific germplasm afterward it doesn't return those fields.