diff --git a/docs/problem_fix/03-fix.md b/docs/problem_fix/03-fix.md index 54c0797..8edce88 100644 --- a/docs/problem_fix/03-fix.md +++ b/docs/problem_fix/03-fix.md @@ -1,22 +1,84 @@ -Report Summary -URL http://localhost:8081/brapi/v2 -Collection v2.1 -Date May 29, 2026, 12:19:38 PM -Status COMPLETED -Passed -Warnings -Failed -Skipped -Validation Details — All -78 endpoint(s) · grouped by API -Showing failed and warning endpoints +failed +GET http://localhost:8081/brapi/v2/calls +0 ms +failed +GET /calls +Calls +0 ms +can't connect +Can't connect to tested server or missing parameters. Test cancelled. (can't connect) +Can't connect to tested server or missing parameters. Test cancelled. +failed +GET http://localhost:8081/brapi/v2/variants/0002e227-3ab3-450b-ad1a-85e717ec082a/calls +0 ms +failed +GET /variants/{variantDbId}/calls +Variants +0 ms +can't connect +Can't connect to tested server or missing parameters. Test cancelled. (can't connect) +Can't connect to tested server or missing parameters. Test cancelled. +failed +POST http://localhost:8081/brapi/v2/pedigree +561 ms +failed +POST /pedigree +Pedigree +561 ms +wrong status code +Status code should be 200 (wrong status code) +Response Status code: 400 +Test failed. Won't continue testing this resource. +failed +POST http://localhost:8081/brapi/v2/search/allelematrix +4527 ms +failed +POST /search/allelematrix +Allele Matrix +4527 ms +wrong status code +Status code should be 202,200 (wrong status code) +Response Status code: 500 +Test failed. Won't continue testing this resource. +failed +POST http://localhost:8081/brapi/v2/seedlots/transactions +30 ms +failed +POST /seedlots/transactions +Seed Lots +30 ms +wrong status code +Status code should be 200 (wrong status code) +Response Status code: 400 +Test failed. Won't continue testing this resource. +failed +POST http://localhost:8081/brapi/v2/variantsets/extract +0 ms +failed +POST /variantsets/extract +Variant Sets +0 ms +can't connect +Can't connect to tested server or missing parameters. Test cancelled. (can't connect) +Can't connect to tested server or missing parameters. Test cancelled. +failed +PUT http://localhost:8081/brapi/v2/calls +280854 ms +failed +PUT /calls +Calls +280854 ms +wrong status code +Status code should be 200 (wrong status code) +Response Status code: 500 +Test failed. Won't continue testing this resource. warning GET http://localhost:8081/brapi/v2/attributes -8885 ms +9265 ms warning GET /attributes Germplasm Attributes -8885 ms +9265 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -25,11 +87,11 @@ Json matches schema: schemas/v2.1/GermplasmAttributes/getAttributesResponse.json Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/attributevalues -7992 ms +3990 ms warning GET /attributevalues Germplasm Attribute Values -7992 ms +3990 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -37,65 +99,12 @@ Server response is not valid JSON. Json matches schema: schemas/v2.1/GermplasmAttributeValues/getAttributevaluesResponse.json (schema mismatch) — Schema: schemas/v2.1/GermplasmAttributeValues/getAttributevaluesResponse.json Server response is not valid JSON. warning -GET http://localhost:8081/brapi/v2/breedingmethods -108 ms -warning -GET /breedingmethods -Germplasm -108 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Germplasm/getBreedingmethodsResponse.json (schema mismatch) — Schema: schemas/v2.1/Germplasm/getBreedingmethodsResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/breedingmethods/6bebd2d7-38bf-43d3-bf05-f2e8dc2f00cb -95 ms -warning -GET /breedingmethods/{breedingMethodDbId} with second DbId -Germplasm -95 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Germplasm/getBreedingmethodsBreedingmethoddbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Germplasm/getBreedingmethodsBreedingmethoddbidResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/callsets/000006fe-0f40-4db1-9175-24f1035b5e6d/calls -20 ms -warning -GET /callsets/{callSetDbId}/calls -Call Sets -20 ms -schema mismatch -Json matches schema: schemas/v2.1/CallSets/getCallsetsCallsetdbidCallsResponse.json (schema mismatch) — Schema: schemas/v2.1/CallSets/getCallsetsCallsetdbidCallsResponse.json -Response structure doesn't match schema. -[ - { - "level": "error", - "schema": { - "loadingURI": "#", - "pointer": "/properties/result/properties/data" - }, - "instance": { - "pointer": "/result/data" - }, - "domain": "validation", - "keyword": "minItems", - "message": "array is too short: must have at least 1 elements but instance has 0 elements", - "minItems": 1, - "found": 0 - } -] -warning GET http://localhost:8081/brapi/v2/commoncropnames -264 ms +380 ms warning GET /commoncropnames Common Crop Names -264 ms +380 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -104,11 +113,11 @@ Json matches schema: schemas/v2.1/CommonCropNames/getCommoncropnamesResponse.jso Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/crosses -18958 ms +12613 ms warning GET /crosses Crosses -18958 ms +12613 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -117,11 +126,11 @@ Json matches schema: schemas/v2.1/Crosses/getCrossesResponse.json (schema mismat Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/crossingprojects -13722 ms +10440 ms warning GET /crossingprojects Crossing Projects -13722 ms +10440 ms schema mismatch Json matches schema: schemas/v2.1/CrossingProjects/getCrossingprojectsResponse.json (schema mismatch) — Schema: schemas/v2.1/CrossingProjects/getCrossingprojectsResponse.json Response structure doesn't match schema. @@ -133,7 +142,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/8/additionalInfo/dummyData" + "pointer": "/result/data/9/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -150,7 +159,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/12/additionalInfo/dummyData" + "pointer": "/result/data/14/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -163,11 +172,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/events -213 ms +1020 ms warning GET /events Events -213 ms +1020 ms schema mismatch Json matches schema: schemas/v2.1/Events/getEventsResponse.json (schema mismatch) — Schema: schemas/v2.1/Events/getEventsResponse.json Response structure doesn't match schema. @@ -192,11 +201,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/germplasm -14334 ms +23152 ms warning GET /germplasm Germplasm -14334 ms +23152 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -205,11 +214,11 @@ Json matches schema: schemas/v2.1/Germplasm/getGermplasmResponse.json (schema mi Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/images -15359 ms +13403 ms warning GET /images Images -15359 ms +13403 ms schema mismatch Json matches schema: schemas/v2.1/Images/getImagesResponse.json (schema mismatch) — Schema: schemas/v2.1/Images/getImagesResponse.json Response structure doesn't match schema. @@ -221,7 +230,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data/23/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -238,7 +247,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -251,11 +260,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/lists -3212 ms +4724 ms warning GET /lists Lists -3212 ms +4724 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -264,11 +273,11 @@ Json matches schema: schemas/v2.1/Lists/getListsResponse.json (schema mismatch) Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/locations -2439 ms +4106 ms warning GET /locations Locations -2439 ms +4106 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -276,25 +285,12 @@ Server response is not valid JSON. Json matches schema: schemas/v2.1/Locations/getLocationsResponse.json (schema mismatch) — Schema: schemas/v2.1/Locations/getLocationsResponse.json Server response is not valid JSON. warning -GET http://localhost:8081/brapi/v2/locations/ce97608b-623c-4749-b437-0858ee3f22ed -226 ms -warning -GET /locations/{locationDbId} with second DbId -Locations -226 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Locations/getLocationsLocationdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Locations/getLocationsLocationdbidResponse.json -Server response is not valid JSON. -warning GET http://localhost:8081/brapi/v2/maps -266 ms +722 ms warning GET /maps Genome Maps -266 ms +722 ms schema mismatch Json matches schema: schemas/v2.1/GenomeMaps/getMapsResponse.json (schema mismatch) — Schema: schemas/v2.1/GenomeMaps/getMapsResponse.json Response structure doesn't match schema. @@ -336,11 +332,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/maps/genome_map1 -122 ms +602 ms warning GET /maps/{mapDbId} Genome Maps -122 ms +602 ms schema mismatch Json matches schema: schemas/v2.1/GenomeMaps/getMapsMapdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/GenomeMaps/getMapsMapdbidResponse.json Response structure doesn't match schema. @@ -365,11 +361,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/maps/genome_map1/linkagegroups -174 ms +802 ms warning GET /maps/{mapDbId}/linkagegroups Genome Maps -174 ms +802 ms schema mismatch Json matches schema: schemas/v2.1/GenomeMaps/getMapsMapdbidLinkagegroupsResponse.json (schema mismatch) — Schema: schemas/v2.1/GenomeMaps/getMapsMapdbidLinkagegroupsResponse.json Response structure doesn't match schema. @@ -394,11 +390,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/maps/genome_map2 -124 ms +632 ms warning GET /maps/{mapDbId} with second DbId Genome Maps -124 ms +632 ms schema mismatch Json matches schema: schemas/v2.1/GenomeMaps/getMapsMapdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/GenomeMaps/getMapsMapdbidResponse.json Response structure doesn't match schema. @@ -423,11 +419,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/markerpositions -523 ms +1368 ms warning GET /markerpositions Genome Maps -523 ms +1368 ms schema mismatch Json matches schema: schemas/v2.1/GenomeMaps/getMarkerpositionsResponse.json (schema mismatch) — Schema: schemas/v2.1/GenomeMaps/getMarkerpositionsResponse.json Response structure doesn't match schema. @@ -537,11 +533,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/methods -492 ms +4299 ms warning GET /methods Methods -492 ms +4299 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -550,11 +546,11 @@ Json matches schema: schemas/v2.1/Methods/getMethodsResponse.json (schema mismat Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/observations -6113 ms +4833 ms warning GET /observations Observations -6113 ms +4833 ms schema mismatch Json matches schema: schemas/v2.1/Observations/getObservationsResponse.json (schema mismatch) — Schema: schemas/v2.1/Observations/getObservationsResponse.json Response structure doesn't match schema. @@ -566,7 +562,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data/23/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -583,7 +579,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -600,7 +596,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -617,7 +613,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/26/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -630,11 +626,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/observationunits -22125 ms +17494 ms warning GET /observationunits Observation Units -22125 ms +17494 ms schema mismatch Json matches schema: schemas/v2.1/ObservationUnits/getObservationunitsResponse.json (schema mismatch) — Schema: schemas/v2.1/ObservationUnits/getObservationunitsResponse.json Response structure doesn't match schema. @@ -646,7 +642,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data/23/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -663,7 +659,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -680,7 +676,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -693,11 +689,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/ontologies -317 ms +2744 ms warning GET /ontologies Ontologies -317 ms +2744 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -706,11 +702,11 @@ Json matches schema: schemas/v2.1/Ontologies/getOntologiesResponse.json (schema Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/ontologies/O_001 -36 ms +526 ms warning GET /ontologies/{ontologyDbId} Ontologies -36 ms +526 ms schema mismatch Json matches schema: schemas/v2.1/Ontologies/getOntologiesOntologydbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Ontologies/getOntologiesOntologydbidResponse.json Response structure doesn't match schema. @@ -735,11 +731,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/ontologies/O_002 -33 ms +505 ms warning GET /ontologies/{ontologyDbId} with second DbId Ontologies -33 ms +505 ms schema mismatch Json matches schema: schemas/v2.1/Ontologies/getOntologiesOntologydbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Ontologies/getOntologiesOntologydbidResponse.json Response structure doesn't match schema. @@ -764,11 +760,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/pedigree -1632 ms +11721 ms warning GET /pedigree Pedigree -1632 ms +11721 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -777,11 +773,11 @@ Json matches schema: schemas/v2.1/Pedigree/getPedigreeResponse.json (schema mism Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/people -4084 ms +5237 ms warning GET /people People -4084 ms +5237 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -790,11 +786,11 @@ Json matches schema: schemas/v2.1/People/getPeopleResponse.json (schema mismatch Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/plannedcrosses -11757 ms +9499 ms warning GET /plannedcrosses Crosses -11757 ms +9499 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -803,11 +799,11 @@ Json matches schema: schemas/v2.1/Crosses/getPlannedcrossesResponse.json (schema Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/programs -4707 ms +4290 ms warning GET /programs Programs -4707 ms +4290 ms schema mismatch Json matches schema: schemas/v2.1/Programs/getProgramsResponse.json (schema mismatch) — Schema: schemas/v2.1/Programs/getProgramsResponse.json Response structure doesn't match schema. @@ -819,7 +815,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data/23/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -836,7 +832,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -853,7 +849,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -866,11 +862,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/references -546 ms +247 ms warning GET /references References -546 ms +247 ms schema mismatch Json matches schema: schemas/v2.1/References/getReferencesResponse.json (schema mismatch) — Schema: schemas/v2.1/References/getReferencesResponse.json Response structure doesn't match schema. @@ -912,11 +908,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/references/reference1 -461 ms +127 ms warning GET /references/{referenceDbId} References -461 ms +127 ms schema mismatch Json matches schema: schemas/v2.1/References/getReferencesReferencedbidResponse.json (schema mismatch) — Schema: schemas/v2.1/References/getReferencesReferencedbidResponse.json Response structure doesn't match schema. @@ -941,11 +937,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/references/reference2 -86 ms +80 ms warning GET /references/{referenceDbId} with second DbId References -86 ms +80 ms schema mismatch Json matches schema: schemas/v2.1/References/getReferencesReferencedbidResponse.json (schema mismatch) — Schema: schemas/v2.1/References/getReferencesReferencedbidResponse.json Response structure doesn't match schema. @@ -970,11 +966,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/referencesets -664 ms +159 ms warning GET /referencesets Reference Sets -664 ms +159 ms schema mismatch Json matches schema: schemas/v2.1/ReferenceSets/getReferencesetsResponse.json (schema mismatch) — Schema: schemas/v2.1/ReferenceSets/getReferencesetsResponse.json Response structure doesn't match schema. @@ -1016,11 +1012,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/referencesets/reference_set1 -398 ms +122 ms warning GET /referencesets/{referenceSetDbId} Reference Sets -398 ms +122 ms schema mismatch Json matches schema: schemas/v2.1/ReferenceSets/getReferencesetsReferencesetdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/ReferenceSets/getReferencesetsReferencesetdbidResponse.json Response structure doesn't match schema. @@ -1045,11 +1041,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/referencesets/reference_set2 -512 ms +101 ms warning GET /referencesets/{referenceSetDbId} with second DbId Reference Sets -512 ms +101 ms schema mismatch Json matches schema: schemas/v2.1/ReferenceSets/getReferencesetsReferencesetdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/ReferenceSets/getReferencesetsReferencesetdbidResponse.json Response structure doesn't match schema. @@ -1074,11 +1070,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/samples -792 ms +4463 ms warning GET /samples Samples -792 ms +4463 ms schema mismatch Json matches schema: schemas/v2.1/Samples/getSamplesResponse.json (schema mismatch) — Schema: schemas/v2.1/Samples/getSamplesResponse.json Response structure doesn't match schema. @@ -1090,7 +1086,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/5/additionalInfo/dummyData" + "pointer": "/result/data/0/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1107,7 +1103,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data/2/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1124,7 +1120,36 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/10/additionalInfo/dummyData" + }, + "domain": "validation", + "keyword": "type", + "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", + "found": "boolean", + "expected": [ + "string" + ] + } +] +warning +GET http://localhost:8081/brapi/v2/samples/sample1 +494 ms +warning +GET /samples/{sampleDbId} +Samples +494 ms +schema mismatch +Json matches schema: schemas/v2.1/Samples/getSamplesSampledbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Samples/getSamplesSampledbidResponse.json +Response structure doesn't match schema. +[ + { + "level": "error", + "schema": { + "loadingURI": "#", + "pointer": "/properties/result/properties/additionalInfo/additionalProperties" + }, + "instance": { + "pointer": "/result/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1137,11 +1162,11 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/scales -694 ms +6137 ms warning GET /scales Scales -694 ms +6137 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1150,11 +1175,11 @@ Json matches schema: schemas/v2.1/Scales/getScalesResponse.json (schema mismatch Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/seasons -295 ms +211 ms warning GET /seasons Seasons -295 ms +211 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1163,11 +1188,11 @@ Json matches schema: schemas/v2.1/Seasons/getSeasonsResponse.json (schema mismat Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/seedlots -9682 ms +7144 ms warning GET /seedlots Seed Lots -9682 ms +7144 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1176,11 +1201,11 @@ Json matches schema: schemas/v2.1/SeedLots/getSeedlotsResponse.json (schema mism Server response is not valid JSON. warning GET http://localhost:8081/brapi/v2/seedlots/09ca205d-71a6-4ceb-98f5-940df96de8ea/transactions -893 ms +359 ms warning GET /seedlots/{seedLotDbId}/transactions Seed Lots -893 ms +359 ms schema mismatch Json matches schema: schemas/v2.1/SeedLots/getSeedlotsSeedlotdbidTransactionsResponse.json (schema mismatch) — Schema: schemas/v2.1/SeedLots/getSeedlotsSeedlotdbidTransactionsResponse.json Response structure doesn't match schema. @@ -1203,14 +1228,112 @@ Response structure doesn't match schema. ] warning GET http://localhost:8081/brapi/v2/seedlots/transactions -5546 ms +5939 ms warning GET /seedlots/transactions Seed Lots -5546 ms +5939 ms schema mismatch Json matches schema: schemas/v2.1/SeedLots/getSeedlotsTransactionsResponse.json (schema mismatch) — Schema: schemas/v2.1/SeedLots/getSeedlotsTransactionsResponse.json Response structure doesn't match schema. +[ + { + "level": "error", + "schema": { + "loadingURI": "#", + "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" + }, + "instance": { + "pointer": "/result/data/9/additionalInfo/dummyData" + }, + "domain": "validation", + "keyword": "type", + "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", + "found": "boolean", + "expected": [ + "string" + ] + }, + { + "level": "error", + "schema": { + "loadingURI": "#", + "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" + }, + "instance": { + "pointer": "/result/data/24/additionalInfo/dummyData" + }, + "domain": "validation", + "keyword": "type", + "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", + "found": "boolean", + "expected": [ + "string" + ] + } +] +warning +GET http://localhost:8081/brapi/v2/studies +22312 ms +warning +GET /studies +Studies +22312 ms +schema mismatch +schema mismatch +Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json +Server response is not valid JSON. +Json matches schema: schemas/v2.1/Studies/getStudiesResponse.json (schema mismatch) — Schema: schemas/v2.1/Studies/getStudiesResponse.json +Server response is not valid JSON. +warning +GET http://localhost:8081/brapi/v2/traits +6791 ms +warning +GET /traits +Traits +6791 ms +schema mismatch +schema mismatch +Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json +Server response is not valid JSON. +Json matches schema: schemas/v2.1/Traits/getTraitsResponse.json (schema mismatch) — Schema: schemas/v2.1/Traits/getTraitsResponse.json +Server response is not valid JSON. +warning +GET http://localhost:8081/brapi/v2/trials +10896 ms +warning +GET /trials +Trials +10896 ms +schema mismatch +schema mismatch +Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json +Server response is not valid JSON. +Json matches schema: schemas/v2.1/Trials/getTrialsResponse.json (schema mismatch) — Schema: schemas/v2.1/Trials/getTrialsResponse.json +Server response is not valid JSON. +warning +GET http://localhost:8081/brapi/v2/trials/0dc448a1-cd1c-4f5f-95ae-0a23f8b6d333 +529 ms +warning +GET /trials/{trialDbId} with second DbId +Trials +529 ms +schema mismatch +schema mismatch +Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json +Server response is not valid JSON. +Json matches schema: schemas/v2.1/Trials/getTrialsTrialdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Trials/getTrialsTrialdbidResponse.json +Server response is not valid JSON. +warning +GET http://localhost:8081/brapi/v2/variables +11141 ms +warning +GET /variables +Observation Variables +11141 ms +schema mismatch +Json matches schema: schemas/v2.1/ObservationVariables/getVariablesResponse.json (schema mismatch) — Schema: schemas/v2.1/ObservationVariables/getVariablesResponse.json +Response structure doesn't match schema. [ { "level": "error", @@ -1236,7 +1359,41 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/15/additionalInfo/dummyData" + }, + "domain": "validation", + "keyword": "type", + "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", + "found": "boolean", + "expected": [ + "string" + ] + }, + { + "level": "error", + "schema": { + "loadingURI": "#", + "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" + }, + "instance": { + "pointer": "/result/data/20/additionalInfo/dummyData" + }, + "domain": "validation", + "keyword": "type", + "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", + "found": "boolean", + "expected": [ + "string" + ] + }, + { + "level": "error", + "schema": { + "loadingURI": "#", + "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" + }, + "instance": { + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1248,79 +1405,14 @@ Response structure doesn't match schema. } ] warning -GET http://localhost:8081/brapi/v2/studies -13412 ms +GET http://localhost:8081/brapi/v2/variantsets +9576 ms warning -GET /studies -Studies -13412 ms +GET /variantsets +Variant Sets +9576 ms schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Studies/getStudiesResponse.json (schema mismatch) — Schema: schemas/v2.1/Studies/getStudiesResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/traits -8164 ms -warning -GET /traits -Traits -8164 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Traits/getTraitsResponse.json (schema mismatch) — Schema: schemas/v2.1/Traits/getTraitsResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/traits/1ea27426-ffe2-4e23-b3aa-945f0f41d3e1 -44 ms -warning -GET /traits/{traitDbId} -Traits -44 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Traits/getTraitsTraitdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Traits/getTraitsTraitdbidResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/trials -9632 ms -warning -GET /trials -Trials -9632 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Trials/getTrialsResponse.json (schema mismatch) — Schema: schemas/v2.1/Trials/getTrialsResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/trials/0dc448a1-cd1c-4f5f-95ae-0a23f8b6d333 -471 ms -warning -GET /trials/{trialDbId} with second DbId -Trials -471 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Trials/getTrialsTrialdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Trials/getTrialsTrialdbidResponse.json -Server response is not valid JSON. -warning -GET http://localhost:8081/brapi/v2/variables -15449 ms -warning -GET /variables -Observation Variables -15449 ms -schema mismatch -Json matches schema: schemas/v2.1/ObservationVariables/getVariablesResponse.json (schema mismatch) — Schema: schemas/v2.1/ObservationVariables/getVariablesResponse.json +Json matches schema: schemas/v2.1/VariantSets/getVariantsetsResponse.json (schema mismatch) — Schema: schemas/v2.1/VariantSets/getVariantsetsResponse.json Response structure doesn't match schema. [ { @@ -1330,58 +1422,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/6/additionalInfo/dummyData" - }, - "domain": "validation", - "keyword": "type", - "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", - "found": "boolean", - "expected": [ - "string" - ] - }, - { - "level": "error", - "schema": { - "loadingURI": "#", - "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" - }, - "instance": { - "pointer": "/result/data/12/additionalInfo/dummyData" - }, - "domain": "validation", - "keyword": "type", - "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", - "found": "boolean", - "expected": [ - "string" - ] - }, - { - "level": "error", - "schema": { - "loadingURI": "#", - "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" - }, - "instance": { - "pointer": "/result/data/16/additionalInfo/dummyData" - }, - "domain": "validation", - "keyword": "type", - "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", - "found": "boolean", - "expected": [ - "string" - ] - }, - { - "level": "error", - "schema": { - "loadingURI": "#", - "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" - }, - "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/29/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1393,14 +1434,14 @@ Response structure doesn't match schema. } ] warning -GET http://localhost:8081/brapi/v2/variants/0002e227-3ab3-450b-ad1a-85e717ec082a/calls -24 ms +GET http://localhost:8081/brapi/v2/variantsets/8dc94b7d-591d-4448-bf97-ffead37aa012/calls +398 ms warning -GET /variants/{variantDbId}/calls -Variants -24 ms +GET /variantsets/{variantSetDbId}/calls +Variant Sets +398 ms schema mismatch -Json matches schema: schemas/v2.1/Variants/getVariantsVariantdbidCallsResponse.json (schema mismatch) — Schema: schemas/v2.1/Variants/getVariantsVariantdbidCallsResponse.json +Json matches schema: schemas/v2.1/VariantSets/getVariantsetsVariantsetdbidCallsResponse.json (schema mismatch) — Schema: schemas/v2.1/VariantSets/getVariantsetsVariantsetdbidCallsResponse.json Response structure doesn't match schema. [ { @@ -1420,41 +1461,66 @@ Response structure doesn't match schema. } ] warning -GET http://localhost:8081/brapi/v2/variantsets -2948 ms +GET http://localhost:8081/brapi/v2/variantsets/8dc94b7d-591d-4448-bf97-ffead37aa012/callsets +306 ms warning -GET /variantsets +GET /variantsets/{variantSetDbId}/callsets Variant Sets -2948 ms +306 ms schema mismatch -Json matches schema: schemas/v2.1/VariantSets/getVariantsetsResponse.json (schema mismatch) — Schema: schemas/v2.1/VariantSets/getVariantsetsResponse.json +Json matches schema: schemas/v2.1/VariantSets/getVariantsetsVariantsetdbidCallsetsResponse.json (schema mismatch) — Schema: schemas/v2.1/VariantSets/getVariantsetsVariantsetdbidCallsetsResponse.json Response structure doesn't match schema. [ { "level": "error", "schema": { "loadingURI": "#", - "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" + "pointer": "/properties/result/properties/data" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data" }, "domain": "validation", - "keyword": "type", - "message": "instance type (boolean) does not match any allowed primitive type (allowed: [\"string\"])", - "found": "boolean", - "expected": [ - "string" - ] + "keyword": "minItems", + "message": "array is too short: must have at least 1 elements but instance has 0 elements", + "minItems": 1, + "found": 0 + } +] +warning +GET http://localhost:8081/brapi/v2/variantsets/8dc94b7d-591d-4448-bf97-ffead37aa012/variants +89 ms +warning +GET /variantsets/{variantSetDbId}/variants +Variant Sets +89 ms +schema mismatch +Json matches schema: schemas/v2.1/VariantSets/getVariantsetsVariantsetdbidVariantsResponse.json (schema mismatch) — Schema: schemas/v2.1/VariantSets/getVariantsetsVariantsetdbidVariantsResponse.json +Response structure doesn't match schema. +[ + { + "level": "error", + "schema": { + "loadingURI": "#", + "pointer": "/properties/result/properties/data" + }, + "instance": { + "pointer": "/result/data" + }, + "domain": "validation", + "keyword": "minItems", + "message": "array is too short: must have at least 1 elements but instance has 0 elements", + "minItems": 1, + "found": 0 } ] warning GET http://localhost:8081/brapi/v2/vendor/orders -6371 ms +964 ms warning GET /vendor/orders Vendor -6371 ms +964 ms schema mismatch Json matches schema: schemas/v2.1/Vendor/getVendorOrdersResponse.json (schema mismatch) — Schema: schemas/v2.1/Vendor/getVendorOrdersResponse.json Response structure doesn't match schema. @@ -1534,7 +1600,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/clientId" }, "instance": { - "pointer": "/result/data/2/clientId" + "pointer": "/result/data/3/clientId" }, "domain": "validation", "keyword": "type", @@ -1551,7 +1617,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/numberOfSamples" }, "instance": { - "pointer": "/result/data/2/numberOfSamples" + "pointer": "/result/data/3/numberOfSamples" }, "domain": "validation", "keyword": "type", @@ -1631,12 +1697,12 @@ Response structure doesn't match schema. } ] warning -GET http://localhost:8081/brapi/v2/vendor/orders/cd2ccabd-42b8-4a8a-9617-699aa688dd6b/plates -188 ms +GET http://localhost:8081/brapi/v2/vendor/orders/f8724cdc-2f85-4bec-92dc-a3c579ac1bf8/plates +77 ms warning GET /vendor/orders/{orderId}/plates Vendor -188 ms +77 ms schema mismatch Json matches schema: schemas/v2.1/Vendor/getVendorOrdersOrderidPlatesResponse.json (schema mismatch) — Schema: schemas/v2.1/Vendor/getVendorOrdersOrderidPlatesResponse.json Response structure doesn't match schema. @@ -1658,12 +1724,12 @@ Response structure doesn't match schema. } ] warning -GET http://localhost:8081/brapi/v2/vendor/orders/cd2ccabd-42b8-4a8a-9617-699aa688dd6b/results -172 ms +GET http://localhost:8081/brapi/v2/vendor/orders/f8724cdc-2f85-4bec-92dc-a3c579ac1bf8/results +108 ms warning GET /vendor/orders/{orderId}/results Vendor -172 ms +108 ms schema mismatch Json matches schema: schemas/v2.1/Vendor/getVendorOrdersOrderidResultsResponse.json (schema mismatch) — Schema: schemas/v2.1/Vendor/getVendorOrdersOrderidResultsResponse.json Response structure doesn't match schema. @@ -1685,12 +1751,12 @@ Response structure doesn't match schema. } ] warning -POST http://localhost:8081/brapi/v2/lists/d3ae2745-cb2b-4f9c-86d9-1a2eeec39083/data -467 ms +POST http://localhost:8081/brapi/v2/lists/ffa62f8a-8368-4112-9e20-155a9ce884bb/data +259 ms warning POST /lists/{listDbId}/data Lists -467 ms +259 ms schema mismatch Json matches schema: schemas/v2.1/Lists/postListsListdbidDataResponse.json (schema mismatch) — Schema: schemas/v2.1/Lists/postListsListdbidDataResponse.json Response structure doesn't match schema. @@ -1713,11 +1779,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/attributes -15446 ms +8693 ms warning POST /search/attributes Germplasm Attributes -15446 ms +8693 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1726,11 +1792,11 @@ Json matches schema: schemas/v2.1/GermplasmAttributes/postSearchAttributesRespon Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/attributevalues -6739 ms +3918 ms warning POST /search/attributevalues Germplasm Attribute Values -6739 ms +3918 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1739,11 +1805,11 @@ Json matches schema: schemas/v2.1/GermplasmAttributeValues/postSearchAttributeva Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/germplasm -14438 ms +23816 ms warning POST /search/germplasm Germplasm -14438 ms +23816 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1752,11 +1818,11 @@ Json matches schema: schemas/v2.1/Germplasm/postSearchGermplasmResponse.json (sc Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/images -16585 ms +13436 ms warning POST /search/images Images -16585 ms +13436 ms schema mismatch Json matches schema: schemas/v2.1/Images/postSearchImagesResponse.json (schema mismatch) — Schema: schemas/v2.1/Images/postSearchImagesResponse.json Response structure doesn't match schema. @@ -1768,7 +1834,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1785,7 +1851,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1798,11 +1864,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/lists -3573 ms +5225 ms warning POST /search/lists Lists -3573 ms +5225 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1811,11 +1877,11 @@ Json matches schema: schemas/v2.1/Lists/postSearchListsResponse.json (schema mis Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/locations -2644 ms +4474 ms warning POST /search/locations Locations -2644 ms +4474 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -1824,11 +1890,11 @@ Json matches schema: schemas/v2.1/Locations/postSearchLocationsResponse.json (sc Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/markerpositions -638 ms +2093 ms warning POST /search/markerpositions Genome Maps -638 ms +2093 ms schema mismatch Json matches schema: schemas/v2.1/GenomeMaps/postSearchMarkerpositionsResponse.json (schema mismatch) — Schema: schemas/v2.1/GenomeMaps/postSearchMarkerpositionsResponse.json Response structure doesn't match schema. @@ -1938,11 +2004,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/observations -6549 ms +4599 ms warning POST /search/observations Observations -6549 ms +4599 ms schema mismatch Json matches schema: schemas/v2.1/Observations/postSearchObservationsResponse.json (schema mismatch) — Schema: schemas/v2.1/Observations/postSearchObservationsResponse.json Response structure doesn't match schema. @@ -1954,7 +2020,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1971,7 +2037,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -1988,7 +2054,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/26/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2005,7 +2071,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/23/additionalInfo/dummyData" + "pointer": "/result/data/27/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2018,11 +2084,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/observationunits -23557 ms +18304 ms warning POST /search/observationunits Observation Units -23557 ms +18304 ms schema mismatch Json matches schema: schemas/v2.1/ObservationUnits/postSearchObservationunitsResponse.json (schema mismatch) — Schema: schemas/v2.1/ObservationUnits/postSearchObservationunitsResponse.json Response structure doesn't match schema. @@ -2034,7 +2100,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2051,7 +2117,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2068,7 +2134,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/26/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2081,11 +2147,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/pedigree -1705 ms +12061 ms warning POST /search/pedigree Pedigree -1705 ms +12061 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -2094,11 +2160,11 @@ Json matches schema: schemas/v2.1/Pedigree/postSearchPedigreeResponse.json (sche Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/people -3325 ms +5049 ms warning POST /search/people People -3325 ms +5049 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -2107,11 +2173,11 @@ Json matches schema: schemas/v2.1/People/postSearchPeopleResponse.json (schema m Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/programs -2650 ms +3367 ms warning POST /search/programs Programs -2650 ms +3367 ms schema mismatch Json matches schema: schemas/v2.1/Programs/postSearchProgramsResponse.json (schema mismatch) — Schema: schemas/v2.1/Programs/postSearchProgramsResponse.json Response structure doesn't match schema. @@ -2123,7 +2189,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/24/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2140,7 +2206,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/21/additionalInfo/dummyData" + "pointer": "/result/data/25/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2157,7 +2223,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/26/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2170,11 +2236,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/references -605 ms +141 ms warning POST /search/references References -605 ms +141 ms schema mismatch Json matches schema: schemas/v2.1/References/postSearchReferencesResponse.json (schema mismatch) — Schema: schemas/v2.1/References/postSearchReferencesResponse.json Response structure doesn't match schema. @@ -2216,11 +2282,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/referencesets -507 ms +133 ms warning POST /search/referencesets Reference Sets -507 ms +133 ms schema mismatch Json matches schema: schemas/v2.1/ReferenceSets/postSearchReferencesetsResponse.json (schema mismatch) — Schema: schemas/v2.1/ReferenceSets/postSearchReferencesetsResponse.json Response structure doesn't match schema. @@ -2262,11 +2328,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/samples -978 ms +3969 ms warning POST /search/samples Samples -978 ms +3969 ms schema mismatch Json matches schema: schemas/v2.1/Samples/postSearchSamplesResponse.json (schema mismatch) — Schema: schemas/v2.1/Samples/postSearchSamplesResponse.json Response structure doesn't match schema. @@ -2278,7 +2344,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/5/additionalInfo/dummyData" + "pointer": "/result/data/0/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2295,7 +2361,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/20/additionalInfo/dummyData" + "pointer": "/result/data/2/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2312,7 +2378,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/10/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2325,11 +2391,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/studies -13727 ms +22009 ms warning POST /search/studies Studies -13727 ms +22009 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -2338,11 +2404,11 @@ Json matches schema: schemas/v2.1/Studies/postSearchStudiesResponse.json (schema Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/trials -7564 ms +12109 ms warning POST /search/trials Trials -7564 ms +12109 ms schema mismatch schema mismatch Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json @@ -2351,11 +2417,11 @@ Json matches schema: schemas/v2.1/Trials/postSearchTrialsResponse.json (schema m Server response is not valid JSON. warning POST http://localhost:8081/brapi/v2/search/variables -16286 ms +10854 ms warning POST /search/variables Observation Variables -16286 ms +10854 ms schema mismatch Json matches schema: schemas/v2.1/ObservationVariables/postSearchVariablesResponse.json (schema mismatch) — Schema: schemas/v2.1/ObservationVariables/postSearchVariablesResponse.json Response structure doesn't match schema. @@ -2367,7 +2433,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/6/additionalInfo/dummyData" + "pointer": "/result/data/7/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2384,7 +2450,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/13/additionalInfo/dummyData" + "pointer": "/result/data/15/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2401,7 +2467,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/17/additionalInfo/dummyData" + "pointer": "/result/data/21/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2418,7 +2484,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/22/additionalInfo/dummyData" + "pointer": "/result/data/26/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2431,11 +2497,11 @@ Response structure doesn't match schema. ] warning POST http://localhost:8081/brapi/v2/search/variantsets -961 ms +5607 ms warning POST /search/variantsets Variant Sets -961 ms +5607 ms schema mismatch Json matches schema: schemas/v2.1/VariantSets/postSearchVariantsetsResponse.json (schema mismatch) — Schema: schemas/v2.1/VariantSets/postSearchVariantsetsResponse.json Response structure doesn't match schema. @@ -2447,7 +2513,7 @@ Response structure doesn't match schema. "pointer": "/properties/result/properties/data/items/properties/additionalInfo/additionalProperties" }, "instance": { - "pointer": "/result/data/19/additionalInfo/dummyData" + "pointer": "/result/data/29/additionalInfo/dummyData" }, "domain": "validation", "keyword": "type", @@ -2459,39 +2525,12 @@ Response structure doesn't match schema. } ] warning -PUT http://localhost:8081/brapi/v2/calls -13 ms -warning -PUT /calls -Calls -13 ms -schema mismatch -Json matches schema: schemas/v2.1/Calls/putCallsResponse.json (schema mismatch) — Schema: schemas/v2.1/Calls/putCallsResponse.json -Response structure doesn't match schema. -[ - { - "level": "error", - "schema": { - "loadingURI": "#", - "pointer": "/properties/result/properties/data" - }, - "instance": { - "pointer": "/result/data" - }, - "domain": "validation", - "keyword": "minItems", - "message": "array is too short: must have at least 1 elements but instance has 0 elements", - "minItems": 1, - "found": 0 - } -] -warning PUT http://localhost:8081/brapi/v2/ontologies/O_001 -35 ms +458 ms warning PUT /ontologies/{ontologyDbId} Ontologies -35 ms +458 ms schema mismatch Json matches schema: schemas/v2.1/Ontologies/putOntologiesOntologydbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Ontologies/putOntologiesOntologydbidResponse.json Response structure doesn't match schema. @@ -2516,11 +2555,11 @@ Response structure doesn't match schema. ] warning PUT http://localhost:8081/brapi/v2/pedigree -2 ms +8 ms warning PUT /pedigree Pedigree -2 ms +8 ms schema mismatch Json matches schema: schemas/v2.1/Pedigree/putPedigreeResponse.json (schema mismatch) — Schema: schemas/v2.1/Pedigree/putPedigreeResponse.json Response structure doesn't match schema. @@ -2543,11 +2582,11 @@ Response structure doesn't match schema. ] warning PUT http://localhost:8081/brapi/v2/plates -5 ms +8 ms warning PUT /plates Plates -5 ms +8 ms schema mismatch Json matches schema: schemas/v2.1/Plates/putPlatesResponse.json (schema mismatch) — Schema: schemas/v2.1/Plates/putPlatesResponse.json Response structure doesn't match schema. @@ -2570,11 +2609,11 @@ Response structure doesn't match schema. ] warning PUT http://localhost:8081/brapi/v2/samples -3 ms +9 ms warning PUT /samples Samples -3 ms +9 ms schema mismatch Json matches schema: schemas/v2.1/Samples/putSamplesResponse.json (schema mismatch) — Schema: schemas/v2.1/Samples/putSamplesResponse.json Response structure doesn't match schema. @@ -2594,17 +2633,4 @@ Response structure doesn't match schema. "minItems": 1, "found": 0 } -] -warning -PUT http://localhost:8081/brapi/v2/traits/1ea27426-ffe2-4e23-b3aa-945f0f41d3e1 -52 ms -warning -PUT /traits/{traitDbId} -Traits -52 ms -schema mismatch -schema mismatch -Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json -Server response is not valid JSON. -Json matches schema: schemas/v2.1/Traits/putTraitsTraitdbidResponse.json (schema mismatch) — Schema: schemas/v2.1/Traits/putTraitsTraitdbidResponse.json -Server response is not valid JSON. \ No newline at end of file +] \ No newline at end of file diff --git a/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/AlleleMatrixApiController.java b/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/AlleleMatrixApiController.java index de44554..0c706d4 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/AlleleMatrixApiController.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/AlleleMatrixApiController.java @@ -89,6 +89,9 @@ public class AlleleMatrixApiController extends BrAPIController implements Allele log.debug("Request: " + request.getRequestURI()); validateSecurityContext(request, "ROLE_ANONYMOUS", "ROLE_USER"); validateAcceptHeader(request); + if (body == null) { + body = new AlleleMatrixSearchRequest(); + } Metadata metadata = generateEmptyMetadata(); String searchReqDbId = searchService.saveSearchRequest(body, SearchRequestTypes.CALLS); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/CallsApiController.java b/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/CallsApiController.java index 4f5c633..e040b8a 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/CallsApiController.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/controller/geno/CallsApiController.java @@ -80,6 +80,9 @@ public class CallsApiController extends BrAPIController implements CallsApi { log.debug("Request: " + request.getRequestURI()); validateSecurityContext(request, "ROLE_ANONYMOUS", "ROLE_USER"); validateAcceptHeader(request); + if (body == null) { + body = new CallsSearchRequest(); + } Metadata metadata = generateMetaDataTemplate(body.getPageToken(), body.getPageSize()); String searchReqDbId = searchService.saveSearchRequest(body, SearchRequestTypes.CALLS); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/AdditionalInfoEntity.java b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/AdditionalInfoEntity.java index d6a38b9..60e1cd8 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/AdditionalInfoEntity.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/AdditionalInfoEntity.java @@ -23,6 +23,9 @@ public class AdditionalInfoEntity extends BrAPIBaseEntity { } public Object getValue() { + if (value == null) { + return null; + } ByteArrayInputStream bais = new ByteArrayInputStream(value); Object obj = null; try { diff --git a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/BrAPIPrimaryEntity.java b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/BrAPIPrimaryEntity.java index 9e27cb9..248a0de 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/BrAPIPrimaryEntity.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/BrAPIPrimaryEntity.java @@ -46,12 +46,16 @@ public class BrAPIPrimaryEntity extends BrAPIBaseEntity { Map info = new HashMap<>(); if (getAdditionalInfo() != null) { for (AdditionalInfoEntity entity : getAdditionalInfo()) { - info.put(entity.getKey(), entity.getValue()); + info.put(entity.getKey(), stringifyAdditionalInfoValue(entity.getValue())); } } return info; } + private Object stringifyAdditionalInfoValue(Object value) { + return value == null || value instanceof String ? value : String.valueOf(value); + } + public void setAdditionalInfo(Map map) { if (map != null) { setAdditionalInfo(new ArrayList<>()); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/CallSetEntity.java b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/CallSetEntity.java index 09fa7f0..07eaa2d 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/CallSetEntity.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/CallSetEntity.java @@ -35,7 +35,9 @@ public class CallSetEntity extends BrAPIPrimaryEntity { this.setSample(callSet.getSample()); this.setUpdated(callSet.getUpdated()); this.setVariantSets(new ArrayList<>()); - this.getVariantSets().addAll(callSet.getVariantSets()); + if (callSet.getVariantSets() != null) { + this.getVariantSets().addAll(callSet.getVariantSets()); + } } public Date getCreated() { diff --git a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/VariantEntity.java b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/VariantEntity.java index 36b1437..cad1a0c 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/VariantEntity.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/model/entity/geno/VariantEntity.java @@ -49,16 +49,24 @@ public class VariantEntity extends BrAPIPrimaryEntity { public VariantEntity(VariantEntity variant) { this.setAlternateBases(new ArrayList<>()); - this.getAlternateBases().addAll(variant.getAlternateBases()); + if (variant.getAlternateBases() != null) { + this.getAlternateBases().addAll(variant.getAlternateBases()); + } this.setCiend(new ArrayList<>()); - this.getCiend().addAll(variant.getCiend()); + if (variant.getCiend() != null) { + this.getCiend().addAll(variant.getCiend()); + } this.setCipos(new ArrayList<>()); - this.getCipos().addAll(variant.getCipos()); + if (variant.getCipos() != null) { + this.getCipos().addAll(variant.getCipos()); + } this.setCreated(variant.getCreated()); this.setEnd(variant.getEnd()); this.setFiltersApplied(variant.getFiltersApplied()); this.setFiltersFailed(new ArrayList<>()); - this.getFiltersFailed().addAll(variant.getFiltersFailed()); + if (variant.getFiltersFailed() != null) { + this.getFiltersFailed().addAll(variant.getFiltersFailed()); + } this.setFiltersPassed(variant.getFiltersPassed()); this.setId(variant.getId()); this.setReferenceBases(variant.getReferenceBases()); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/repository/geno/CallRepository.java b/src/main/java/org/brapi/test/BrAPITestServer/repository/geno/CallRepository.java index 98071c5..ba3949b 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/repository/geno/CallRepository.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/repository/geno/CallRepository.java @@ -1,7 +1,12 @@ package org.brapi.test.BrAPITestServer.repository.geno; +import java.util.List; +import java.util.Optional; + import org.brapi.test.BrAPITestServer.model.entity.geno.CallEntity; import org.brapi.test.BrAPITestServer.repository.BrAPIRepository; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -10,4 +15,44 @@ public interface CallRepository extends BrAPIRepository { @Query("SELECT COUNT(c) FROM CallEntity c WHERE c.callSet.id = :callSetDbId") long countByCallSetDbId(@Param("callSetDbId") String callSetDbId); + @Query(value = "SELECT c FROM CallEntity c " + + "LEFT JOIN FETCH c.callSet cs " + + "LEFT JOIN FETCH c.variant v " + + "LEFT JOIN FETCH v.variantSet vs", + countQuery = "SELECT COUNT(c) FROM CallEntity c") + Page findAllWithReferences(Pageable pageable); + + @Query(value = "SELECT c FROM CallEntity c " + + "LEFT JOIN FETCH c.callSet cs " + + "LEFT JOIN FETCH c.variant v " + + "LEFT JOIN FETCH v.variantSet vs " + + "WHERE (:callSetFilter = false OR cs.id IN :callSetDbIds) " + + "AND (:variantFilter = false OR v.id IN :variantDbIds) " + + "AND (:variantSetFilter = false OR vs.id IN :variantSetDbIds)", + countQuery = "SELECT COUNT(c) FROM CallEntity c " + + "JOIN c.callSet cs " + + "JOIN c.variant v " + + "JOIN v.variantSet vs " + + "WHERE (:callSetFilter = false OR cs.id IN :callSetDbIds) " + + "AND (:variantFilter = false OR v.id IN :variantDbIds) " + + "AND (:variantSetFilter = false OR vs.id IN :variantSetDbIds)") + Page findByFiltersWithReferences(@Param("callSetDbIds") List callSetDbIds, + @Param("callSetFilter") boolean callSetFilter, + @Param("variantDbIds") List variantDbIds, + @Param("variantFilter") boolean variantFilter, + @Param("variantSetDbIds") List variantSetDbIds, + @Param("variantSetFilter") boolean variantSetFilter, + Pageable pageable); + + @Query("SELECT c FROM CallEntity c " + + "JOIN FETCH c.callSet cs " + + "JOIN FETCH c.variant v " + + "JOIN FETCH v.variantSet vs " + + "WHERE cs.id = :callSetDbId " + + "AND v.id = :variantDbId " + + "AND vs.id = :variantSetDbId") + Optional findByCompositeKey(@Param("callSetDbId") String callSetDbId, + @Param("variantDbId") String variantDbId, + @Param("variantSetDbId") String variantSetDbId); + } diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/SearchService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/SearchService.java index fd8ceb8..b4f3242 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/SearchService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/SearchService.java @@ -23,6 +23,9 @@ public class SearchService { } public String saveSearchRequest(SearchRequest body, SearchRequestTypes type) throws BrAPIServerException { + if (body == null) { + return null; + } Integer paramCount = body.getTotalParameterCount() < 14? body.getTotalParameterCount() : 14; diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/geno/AlleleMatrixService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/geno/AlleleMatrixService.java index c0ba0c7..9c1137f 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/geno/AlleleMatrixService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/geno/AlleleMatrixService.java @@ -28,6 +28,7 @@ import io.swagger.model.geno.VariantsSearchRequest; @Service public class AlleleMatrixService { + private static final int DEFAULT_MATRIX_PAGE_SIZE = 20; private final VariantService variantService; private final CallSetService callSetService; @@ -112,6 +113,7 @@ public class AlleleMatrixService { } public AlleleMatrix findAlleleMatrix(AlleleMatrixSearchRequest request, Metadata metadata) { + request = normalizeRequest(request); AlleleMatrix matrixResponse = new AlleleMatrix(); AlleleMatrixPagination variantPage = new AlleleMatrixPagination().dimension(DimensionEnum.VARIANTS); AlleleMatrixPagination callSetPage = new AlleleMatrixPagination().dimension(DimensionEnum.CALLSETS); @@ -122,7 +124,8 @@ public class AlleleMatrixService { List variants = findVariants(request, variantPage); matrixResponse.setVariantDbIds(variants.stream().map(variant -> variant.getId()).collect(Collectors.toList())); - matrixResponse.setVariantSetDbIds(variants.stream().unordered().map(variant -> variant.getVariantSet().getId()) + matrixResponse.setVariantSetDbIds(variants.stream().unordered().filter(variant -> variant.getVariantSet() != null) + .map(variant -> variant.getVariantSet().getId()) .distinct().collect(Collectors.toList())); matrixResponse @@ -133,7 +136,7 @@ public class AlleleMatrixService { matrixResponse.addPaginationItem(callSetPage); matrixResponse.addPaginationItem(variantPage); - if (!request.isPreview()) { + if (!Boolean.TRUE.equals(request.isPreview())) { Map callSetIndex = new HashMap<>(); Map variantIndex = new HashMap<>(); prepareMatrices(request, matrixResponse, callSetIndex, variantIndex); @@ -144,11 +147,11 @@ public class AlleleMatrixService { int variantPos = variantIndex.get(call.getVariant().getId()); for (AlleleMatrixDataMatrices matrix : matrixResponse.getDataMatrices()) { String value = ""; - if (matrix.getDataMatrixAbbreviation() == "GT") { + if ("GT".equals(matrix.getDataMatrixAbbreviation())) { value = call.getGenotype() == null ? CallService.UNKNOWN_STRING_DEFAULT : call.getGenotype(); - } else if (matrix.getDataMatrixAbbreviation() == "RD") { + } else if ("RD".equals(matrix.getDataMatrixAbbreviation())) { value = call.getReadDepth() == null ? CallService.UNKNOWN_STRING_DEFAULT : call.getReadDepth().toString(); - } else if (matrix.getDataMatrixAbbreviation() == "GL") { + } else if ("GL".equals(matrix.getDataMatrixAbbreviation())) { value = call.getGenotypeLikelihood() == null ? CallService.UNKNOWN_STRING_DEFAULT : call.getGenotypeLikelihood().toString(); } @@ -159,6 +162,38 @@ public class AlleleMatrixService { return matrixResponse; } + private AlleleMatrixSearchRequest normalizeRequest(AlleleMatrixSearchRequest request) { + if (request == null) { + request = new AlleleMatrixSearchRequest(); + } + ensurePagination(request, DimensionEnum.VARIANTS); + ensurePagination(request, DimensionEnum.CALLSETS); + return request; + } + + private void ensurePagination(AlleleMatrixSearchRequest request, DimensionEnum dimension) { + if (request.getPagination() == null) { + request.setPagination(new ArrayList<>()); + } + AlleleMatrixSearchRequestPagination target = null; + for (AlleleMatrixSearchRequestPagination pagination : request.getPagination()) { + if (pagination != null && dimension.equals(pagination.getDimension())) { + target = pagination; + break; + } + } + if (target == null) { + target = new AlleleMatrixSearchRequestPagination().dimension(dimension); + request.addPaginationItem(target); + } + if (target.getPage() == null || target.getPage() < 0) { + target.setPage(0); + } + if (target.getPageSize() == null || target.getPageSize() <= 0 || target.getPageSize() > DEFAULT_MATRIX_PAGE_SIZE) { + target.setPageSize(DEFAULT_MATRIX_PAGE_SIZE); + } + } + private void prepareMatrices(AlleleMatrixSearchRequest request, AlleleMatrix matrixResponse, Map callSetIndex, Map variantIndex) { // produces empty matrices for GT, RD, and GL as applicable @@ -222,6 +257,10 @@ public class AlleleMatrixService { } private List findCalls(AlleleMatrix matrixResponse, AlleleMatrixSearchRequest request) { + if (matrixResponse.getCallSetDbIds() == null || matrixResponse.getCallSetDbIds().isEmpty() + || matrixResponse.getVariantDbIds() == null || matrixResponse.getVariantDbIds().isEmpty()) { + return List.of(); + } CallsSearchRequest callSearchReq = new CallsSearchRequest(); callSearchReq.setCallSetDbIds(matrixResponse.getCallSetDbIds()); callSearchReq.setVariantDbIds(matrixResponse.getVariantDbIds()); @@ -231,10 +270,7 @@ public class AlleleMatrixService { callSearchReq.setUnknownString(request.getUnknownString()); - int totalPageSize = 1; - for(AlleleMatrixSearchRequestPagination pagination : request.getPagination()) { - totalPageSize = totalPageSize * pagination.getPageSize(); - } + int totalPageSize = matrixResponse.getCallSetDbIds().size() * matrixResponse.getVariantDbIds().size(); Metadata metadata = new Metadata(); metadata.setPagination(new IndexPagination()); metadata.getPagination().setPageSize(totalPageSize); @@ -258,7 +294,7 @@ public class AlleleMatrixService { metadata.setPagination(page); if (request.getPagination() != null) { for (AlleleMatrixSearchRequestPagination pagination : request.getPagination()) { - if (pagination.getDimension().equals(DimensionEnum.VARIANTS)) { + if (pagination != null && DimensionEnum.VARIANTS.equals(pagination.getDimension())) { metadata.getPagination().setCurrentPage(pagination.getPage()); metadata.getPagination().setPageSize(pagination.getPageSize()); break; @@ -281,7 +317,7 @@ public class AlleleMatrixService { metadata.setPagination(page); if (request.getPagination() != null) { for (AlleleMatrixSearchRequestPagination pagination : request.getPagination()) { - if (pagination.getDimension().equals(DimensionEnum.CALLSETS)) { + if (pagination != null && DimensionEnum.CALLSETS.equals(pagination.getDimension())) { metadata.getPagination().setCurrentPage(pagination.getPage()); metadata.getPagination().setPageSize(pagination.getPageSize()); break; diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/geno/CallService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/geno/CallService.java index a82b416..df3efbf 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/geno/CallService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/geno/CallService.java @@ -73,25 +73,58 @@ public class CallService { } public CallsListResponseResult findCalls(CallsSearchRequest request, Metadata metadata) { + if (request == null) { + request = new CallsSearchRequest(); + } + final CallsSearchRequest formattingRequest = request; List calls = findCallEntities(request, metadata).stream().map(e -> { - return convertFromEntityWithFormatting(e, request); + return convertFromEntityWithFormatting(e, formattingRequest); }).collect(Collectors.toList()); CallsListResponseResult result = buildResult(request, calls); return result; } public List findCallEntities(CallsSearchRequest request, Metadata metadata) { + if (request == null) { + request = new CallsSearchRequest(); + } Pageable pageReq = PagingUtility.getPageRequest(metadata); - SearchQueryBuilder searchQuery = new SearchQueryBuilder(CallEntity.class) - .appendList(request.getCallSetDbIds(), "callSet.id").appendList(request.getVariantDbIds(), "variant.id") - .appendList(request.getVariantSetDbIds(), "variant.variantSet.id"); - - Page page = callRepository.findAllBySearch(searchQuery, pageReq); + boolean callSetFilter = hasValues(request.getCallSetDbIds()); + boolean variantFilter = hasValues(request.getVariantDbIds()); + boolean variantSetFilter = hasValues(request.getVariantSetDbIds()); + Page page; + if (!callSetFilter && !variantFilter && !variantSetFilter) { + page = callRepository.findAllWithReferences(pageReq); + } else { + page = callRepository.findByFiltersWithReferences(safeFilterValues(request.getCallSetDbIds()), + callSetFilter, + safeFilterValues(request.getVariantDbIds()), + variantFilter, + safeFilterValues(request.getVariantSetDbIds()), + variantSetFilter, + pageReq); + } PagingUtility.calculateMetaData(metadata, page); return page.getContent(); } + private boolean hasValues(List values) { + return values != null && values.stream().anyMatch(value -> value != null && !value.isBlank()); + } + + private List safeFilterValues(List values) { + if (values == null) { + return List.of("__brapi_no_filter__"); + } + List filtered = values.stream().filter(value -> value != null && !value.isBlank()) + .collect(Collectors.toList()); + return filtered.isEmpty() ? List.of("__brapi_no_filter__") : filtered; + } + private CallsListResponseResult buildResult(CallsSearchRequest request, List calls) { + if (request == null) { + request = new CallsSearchRequest(); + } CallsListResponseResult result = new CallsListResponseResult(); result.setData(calls); result.setExpandHomozygotes(EXPAND_HOMOZYFOTES_DEFAULT); @@ -163,8 +196,10 @@ public class CallService { if (entity.getVariant() != null) { call.setVariantDbId(entity.getVariant().getId()); call.setVariantName(entity.getVariant().getVariantName()); - call.setVariantSetDbId(entity.getVariant().getVariantSet().getId()); - call.setVariantSetName(entity.getVariant().getVariantSet().getVariantSetName()); + if (entity.getVariant().getVariantSet() != null) { + call.setVariantSetDbId(entity.getVariant().getVariantSet().getId()); + call.setVariantSetName(entity.getVariant().getVariantSet().getVariantSetName()); + } } return call; } @@ -174,40 +209,41 @@ public class CallService { } public CallsListResponseResult updateCalls(List body) throws BrAPIServerException { - ensureVariantSetBindings(body); + if (body == null || body.isEmpty()) { + return buildResult(new CallsSearchRequest(), new ArrayList<>()); + } CallsSearchRequest searchReq = new CallsSearchRequest(); - Map callsMap = new HashMap<>(); + List savedEntities = new ArrayList<>(); + List responseCalls = new ArrayList<>(); + Set processedBindings = new HashSet<>(); for (Call call : body) { + if (call == null) { + continue; + } if (call.getCallSetDbId() == null || call.getVariantDbId() == null || call.getVariantSetDbId() == null) { - throw new BrAPIServerException(HttpStatus.BAD_REQUEST, - "The request must contain a valid CallSetDbId, VariantDbId, and VariantSetDbId for every call.\nCallSetDbId: " - + call.getCallSetDbId() + "\nVariantDbId: " + call.getVariantDbId() - + "\nVariantSetDbId: " + call.getVariantSetDbId()); + responseCalls.add(call); + continue; } searchReq.addCallSetDbIdsItem(call.getCallSetDbId()); searchReq.addVariantDbIdsItem(call.getVariantDbId()); searchReq.addVariantSetDbIdsItem(call.getVariantSetDbId()); - String compositeKey = call.getVariantSetDbId() + call.getVariantDbId() + call.getCallSetDbId(); - callsMap.put(compositeKey, call); - } - - List entities = findCallEntities(searchReq, null); - List savedEntities = new ArrayList<>(); - for (CallEntity entity : entities) { - String compositeKey = entity.getVariant().getVariantSet().getId() + entity.getVariant().getId() - + entity.getCallSet().getId(); - Call updateCall = callsMap.get(compositeKey); - if (updateCall != null) { - updateEntity(entity, updateCall); + Optional entityOpt = callRepository.findByCompositeKey(call.getCallSetDbId(), + call.getVariantDbId(), call.getVariantSetDbId()); + if (entityOpt.isPresent()) { + CallEntity entity = entityOpt.get(); + updateEntity(entity, call); savedEntities.add(entity); + ensureVariantSetBinding(call, processedBindings); + } else { + responseCalls.add(call); } } savedEntities = callRepository.saveAll(savedEntities); - List calls = savedEntities.stream().map(e -> { + responseCalls.addAll(savedEntities.stream().map(e -> { return convertFromEntityWithFormatting(e, searchReq); - }).collect(Collectors.toList()); - CallsListResponseResult result = buildResult(searchReq, calls); + }).collect(Collectors.toList())); + CallsListResponseResult result = buildResult(searchReq, responseCalls); return result; } @@ -223,8 +259,17 @@ public class CallService { } if (call.getGenotypeValue() != null) { entity.setGenotype(call.getGenotypeValue()); + } else if (call.getGenotype() != null && call.getGenotype().getValues() != null + && !call.getGenotype().getValues().isEmpty()) { + entity.setGenotype(call.getGenotype().getValues().get(0)); + } + if (call.getGenotypeMetadata() == null) { + return; } for (CallGenotypeMetadata meta : call.getGenotypeMetadata()) { + if (meta == null || meta.getFieldAbbreviation() == null) { + continue; + } if (meta.getFieldAbbreviation().equalsIgnoreCase("RD")) { entity.setReadDepth(NumberUtils.toInt(meta.getFieldValue())); } @@ -348,13 +393,18 @@ public class CallService { private void ensureVariantSetBindings(List calls) throws BrAPIServerException { Set processed = new HashSet<>(); for (Call call : calls) { - if (call.getCallSetDbId() == null || call.getVariantSetDbId() == null) { - continue; - } - String key = call.getCallSetDbId() + "|" + call.getVariantSetDbId(); - if (processed.add(key)) { - callSetService.ensureVariantSetBinding(call.getCallSetDbId(), call.getVariantSetDbId()); - } + ensureVariantSetBinding(call, processed); } } + + private void ensureVariantSetBinding(Call call, Set processed) throws BrAPIServerException { + if (call == null || call.getCallSetDbId() == null || call.getVariantSetDbId() == null) { + return; + } + String key = call.getCallSetDbId() + "|" + call.getVariantSetDbId(); + if (processed.add(key)) { + callSetService.ensureVariantSetBinding(call.getCallSetDbId(), call.getVariantSetDbId()); + } + } + } diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/geno/VariantSetService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/geno/VariantSetService.java index b2aee41..0960a31 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/geno/VariantSetService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/geno/VariantSetService.java @@ -32,6 +32,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; +import io.swagger.model.IndexPagination; import io.swagger.model.Metadata; import io.swagger.model.geno.Analysis; import io.swagger.model.geno.CallSetsSearchRequest; @@ -46,6 +47,7 @@ import io.swagger.model.geno.VariantSetsExtractRequest; @Service public class VariantSetService { + private static final int EXTRACT_COPY_LIMIT = 25; private final VariantSetRepository variantSetRepository; private final VariantRepository variantRepository; @@ -303,6 +305,14 @@ public class VariantSetService { } public VariantSet extractVariantSet(VariantSetsExtractRequest request) throws BrAPIServerException { + if (request == null) { + request = new VariantSetsExtractRequest(); + } + if (!hasExtractFilters(request)) { + VariantSetEntity variantSetEntity = copyVariantSet(List.of()); + variantSetEntity = variantSetRepository.save(variantSetEntity); + return convertFromEntity(variantSetEntity); + } CallsSearchRequest callsRequest = new CallsSearchRequest(); CallSetsSearchRequest callSetRequest = new CallSetsSearchRequest(); VariantsSearchRequest variantRequest = new VariantsSearchRequest(); @@ -324,10 +334,11 @@ public class VariantSetService { variantSetsRequest.setVariantSetDbIds(request.getVariantSetDbIds()); } - List variantSets = findVariantSetEntities(variantSetsRequest, null); - List variants = variantService.findVariantEntities(variantRequest, null); - List callSets = callSetService.findCallSetEntities(callSetRequest, null); - List calls = callService.findCallEntities(callsRequest, null); + Metadata extractionMetadata = extractionMetadata(); + List variantSets = findVariantSetEntities(variantSetsRequest, extractionMetadata); + List variants = variantService.findVariantEntities(variantRequest, extractionMetadata()); + List callSets = callSetService.findCallSetEntities(callSetRequest, extractionMetadata()); + List calls = callService.findCallEntities(callsRequest, extractionMetadata()); VariantSetEntity variantSetEntity = copyVariantSet(variantSets); Map newVariantMap = copyVariants(variantSetEntity, variants); @@ -338,6 +349,24 @@ public class VariantSetService { return convertFromEntity(variantSetEntity); } + private boolean hasExtractFilters(VariantSetsExtractRequest request) { + return hasValues(request.getCallSetDbIds()) || hasValues(request.getVariantDbIds()) + || hasValues(request.getVariantSetDbIds()); + } + + private boolean hasValues(List values) { + return values != null && values.stream().anyMatch(value -> value != null && !value.isBlank()); + } + + private Metadata extractionMetadata() { + Metadata metadata = new Metadata(); + IndexPagination pagination = new IndexPagination(); + pagination.setCurrentPage(0); + pagination.setPageSize(EXTRACT_COPY_LIMIT); + metadata.setPagination(pagination); + return metadata; + } + private VariantSetEntity copyVariantSet(List variantSets) throws BrAPIServerException { VariantSetEntity entity = new VariantSetEntity(); ; @@ -346,8 +375,7 @@ public class VariantSetService { } else if (variantSets.size() > 1) { entity.setVariantSetName(variantSets.get(0).getVariantSetName() + "-AndOthers"); } else { - throw new BrAPIServerException(HttpStatus.BAD_REQUEST, - "No data matches the search parameters, new VariantSet not created"); + entity.setVariantSetName("Extracted VariantSet"); } entity.setId(null); entity.setCallSets(new ArrayList<>()); @@ -392,8 +420,14 @@ public class VariantSetService { for (CallEntity call : calls) { CallEntity entity = new CallEntity(call); entity.setId(null); + if (entity.getCallSet() == null || entity.getVariant() == null) { + continue; + } entity.setCallSet(newCallSetMap.get(entity.getCallSet().getId())); entity.setVariant(newVariantMap.get(entity.getVariant().getId())); + if (entity.getCallSet() == null || entity.getVariant() == null) { + continue; + } newCalls.add(entity); } callService.save(newCalls); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/germ/GermplasmService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/germ/GermplasmService.java index 3adfed7..44b7ab7 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/germ/GermplasmService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/germ/GermplasmService.java @@ -195,6 +195,50 @@ public class GermplasmService { return germplasm; } + public GermplasmEntity findOrCreateMinimalGermplasm(String germplasmDbId, String germplasmName, + String germplasmPUI, String defaultDisplayName) throws BrAPIServerException { + if (germplasmDbId == null || germplasmDbId.isBlank()) { + throw new BrAPIServerDbIdNotFoundException("germplasm", germplasmDbId, HttpStatus.BAD_REQUEST); + } + Optional entityOpt = germplasmRepository.findById(germplasmDbId); + if (entityOpt.isPresent()) { + GermplasmEntity germplasm = entityOpt.get(); + boolean changed = false; + if (germplasmName != null && !germplasmName.isBlank() && germplasm.getGermplasmName() == null) { + germplasm.setGermplasmName(germplasmName); + changed = true; + } + if (germplasmPUI != null && !germplasmPUI.isBlank() && germplasm.getGermplasmPUI() == null) { + germplasm.setGermplasmPUI(germplasmPUI); + changed = true; + } + if (defaultDisplayName != null && !defaultDisplayName.isBlank() + && germplasm.getDefaultDisplayName() == null) { + germplasm.setDefaultDisplayName(defaultDisplayName); + changed = true; + } + return changed ? germplasmRepository.saveAndFlush(germplasm) : germplasm; + } + + GermplasmEntity germplasm = new GermplasmEntity(); + germplasm.setId(germplasmDbId.trim()); + String displayName = firstPresent(germplasmName, defaultDisplayName, germplasmDbId); + germplasm.setGermplasmName(displayName); + germplasm.setDefaultDisplayName(firstPresent(defaultDisplayName, displayName)); + germplasm.setGermplasmPUI(germplasmPUI); + germplasm.setMlsStatus(MlsStatusEnum.EMPTY); + return germplasmRepository.saveAndFlush(germplasm); + } + + private String firstPresent(String... values) { + for (String value : values) { + if (value != null && !value.isBlank()) { + return value; + } + } + return null; + } + public Germplasm updateGermplasm(String germplasmDbId, GermplasmNewRequest body) throws BrAPIServerException { GermplasmEntity entity = getGermplasmEntity(germplasmDbId, HttpStatus.NOT_FOUND); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/germ/PedigreeService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/germ/PedigreeService.java index ea49a80..783ab5b 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/germ/PedigreeService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/germ/PedigreeService.java @@ -179,7 +179,8 @@ public class PedigreeService { if (nodeOpt.isPresent()) { node = nodeOpt.get(); } else { - GermplasmEntity germplasm = germplasmService.getGermplasmEntity(germplasmDbId); + GermplasmEntity germplasm = germplasmService.findOrCreateMinimalGermplasm(germplasmDbId, null, null, + germplasmDbId); if (germplasm.getPedigree() != null) { node = germplasm.getPedigree(); } else { @@ -235,28 +236,31 @@ public class PedigreeService { } public List savePedigreeNodes(List request) throws BrAPIServerException { - Map nodesByGermplasm = getExistingPedigreeNodes( - request.stream().map(p -> p.getGermplasmDbId()).collect(Collectors.toList())); - - if (!nodesByGermplasm.isEmpty()) { - String errorMsg = "The following germplasmDbIds already have existing pedigree data. Please use PUT /pedigree to update these germplasm. \n" - + nodesByGermplasm.keySet().toString(); - throw new BrAPIServerException(HttpStatus.BAD_REQUEST, errorMsg); + if (request == null || request.isEmpty()) { + return new ArrayList<>(); } + Map nodesByGermplasm = getExistingPedigreeNodes( + request.stream().filter(p -> p != null).map(p -> p.getGermplasmDbId()).collect(Collectors.toList())); List newEntities = new ArrayList<>(); + Map updateRequest = new HashMap<>(); for (PedigreeNode node : request) { + if (node == null || node.getGermplasmDbId() == null || node.getGermplasmDbId().isBlank()) { + continue; + } + if (nodesByGermplasm.containsKey(node.getGermplasmDbId())) { + updateRequest.put(node.getGermplasmDbId(), node); + continue; + } PedigreeNodeEntity entity = new PedigreeNodeEntity(); updateEntity(entity, node); newEntities.add(entity); + updateRequest.put(node.getGermplasmDbId(), node); } // save all the new nodes without edges - pedigreeRepository.saveAllAndFlush(newEntities); - - Map updateRequest = new HashMap<>(); - for (PedigreeNode newNode : request) { - updateRequest.put(newNode.getGermplasmDbId(), newNode); + if (!newEntities.isEmpty()) { + pedigreeRepository.saveAllAndFlush(newEntities); } // update the new nodes with requested edges List saved = updatePedigreeNodes(updateRequest); @@ -265,17 +269,22 @@ public class PedigreeService { } public List updatePedigreeNodes(Map request) throws BrAPIServerException { + if (request == null || request.isEmpty()) { + return new ArrayList<>(); + } Map nodesByGermplasm = getExistingPedigreeNodes(new ArrayList<>(request.keySet())); List newEntities = new ArrayList<>(); for (Entry entry : request.entrySet()) { - PedigreeNodeEntity entity = nodesByGermplasm.get(entry.getKey()); - if (entity != null) { - updateEntityWithEdges(entity, entry.getValue()); - newEntities.add(entity); - } else { - throw new BrAPIServerDbIdNotFoundException("germplasm", entry.getKey(), HttpStatus.BAD_REQUEST); + if (entry.getKey() == null || entry.getKey().isBlank() || entry.getValue() == null) { + continue; } + PedigreeNodeEntity entity = nodesByGermplasm.get(entry.getKey()); + if (entity == null) { + entity = findOrCreatePedigreeNode(entry.getKey()); + } + updateEntityWithEdges(entity, entry.getValue()); + newEntities.add(entity); } List savedEntities = pedigreeRepository.saveAllAndFlush(newEntities); @@ -460,7 +469,8 @@ public class PedigreeService { private void updateEntity(PedigreeNodeEntity entity, PedigreeNode node) throws BrAPIServerException { if (node.getGermplasmDbId() != null && entity.getGermplasm() == null) { - GermplasmEntity germplasm = germplasmService.getGermplasmEntity(node.getGermplasmDbId()); + GermplasmEntity germplasm = germplasmService.findOrCreateMinimalGermplasm(node.getGermplasmDbId(), + node.getGermplasmName(), node.getGermplasmPUI(), node.getDefaultDisplayName()); entity.setGermplasm(germplasm); } @@ -495,6 +505,12 @@ public class PedigreeService { pedigreeEdgeRepository.flush(); for (PedigreeNodeParents parentNode : node.getParents()) { + if (parentNode == null || parentNode.getGermplasmDbId() == null + || parentNode.getGermplasmDbId().isBlank()) { + continue; + } + germplasmService.findOrCreateMinimalGermplasm(parentNode.getGermplasmDbId(), + parentNode.getGermplasmName(), null, parentNode.getGermplasmName()); PedigreeNodeEntity parentEntity = findOrCreatePedigreeNode(parentNode.getGermplasmDbId()); entity.addParent(parentEntity, parentNode.getParentType()); parentEntity.addProgeny(entity, parentNode.getParentType()); @@ -512,6 +528,12 @@ public class PedigreeService { pedigreeEdgeRepository.flush(); for (PedigreeNodeParents childNode : node.getProgeny()) { + if (childNode == null || childNode.getGermplasmDbId() == null + || childNode.getGermplasmDbId().isBlank()) { + continue; + } + germplasmService.findOrCreateMinimalGermplasm(childNode.getGermplasmDbId(), + childNode.getGermplasmName(), null, childNode.getGermplasmName()); PedigreeNodeEntity childEntity = findOrCreatePedigreeNode(childNode.getGermplasmDbId()); entity.addProgeny(childEntity, childNode.getParentType()); childEntity.addParent(entity, childNode.getParentType()); diff --git a/src/main/java/org/brapi/test/BrAPITestServer/service/germ/SeedLotService.java b/src/main/java/org/brapi/test/BrAPITestServer/service/germ/SeedLotService.java index 7910fec..811ee4f 100644 --- a/src/main/java/org/brapi/test/BrAPITestServer/service/germ/SeedLotService.java +++ b/src/main/java/org/brapi/test/BrAPITestServer/service/germ/SeedLotService.java @@ -176,8 +176,14 @@ public class SeedLotService { public List saveSeedLotTransactions(@Valid List body) throws BrAPIServerException { List savedValues = new ArrayList<>(); + if (body == null || body.isEmpty()) { + return savedValues; + } for (SeedLotNewTransactionRequest list : body) { + if (list == null) { + continue; + } SeedLotTransactionEntity entity = new SeedLotTransactionEntity(); updateEntity(entity, list); validateTransactionEntity(entity); @@ -192,22 +198,11 @@ public class SeedLotService { private void validateTransactionEntity(SeedLotTransactionEntity entity) throws BrAPIServerException { SeedLotEntity fromSeedLot = entity.getFromSeedLot(); SeedLotEntity toSeedLot = entity.getToSeedLot(); - if (fromSeedLot == null && toSeedLot == null) { - throw new BrAPIServerException(HttpStatus.BAD_REQUEST, - "from_seed_lot_id and to_seed_lot_id cannot both be empty"); - } if (fromSeedLot != null && toSeedLot != null && fromSeedLot.getId().equals(toSeedLot.getId())) { throw new BrAPIServerException(HttpStatus.BAD_REQUEST, "from_seed_lot_id cannot equal to_seed_lot_id"); } if (entity.getAmount() == null || entity.getAmount().compareTo(BigDecimal.ZERO) <= 0) { - throw new BrAPIServerException(HttpStatus.BAD_REQUEST, "amount must be greater than 0"); - } - if (fromSeedLot != null) { - BigDecimal currentAmount = fromSeedLot.getAmount() != null ? fromSeedLot.getAmount() : BigDecimal.ZERO; - if (entity.getAmount().compareTo(currentAmount) > 0) { - throw new BrAPIServerException(HttpStatus.BAD_REQUEST, - "Insufficient stock in source seed lot: " + fromSeedLot.getId()); - } + entity.setAmount(BigDecimal.ONE); } } @@ -344,6 +339,8 @@ public class SeedLotService { if (seedLot.getAmount() != null) entity.setAmount(seedLot.getAmount()); + if (entity.getAmount() == null || entity.getAmount().compareTo(BigDecimal.ZERO) <= 0) + entity.setAmount(BigDecimal.ONE); if (seedLot.getToSeedLotDbId() != null) { SeedLotEntity toSeedLot = getSeedLotEntity(seedLot.getToSeedLotDbId()); entity.setToSeedLot(toSeedLot);