You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

ONAP Guidelines

Finally found general ONAP Advise:

"The API specification should describe the right HTTP status code to return the client.

Status codes should align with IETF's HTTP Status Code Registry: https://www.ietf.org/assignments/http-status-codes/http-status-codes.xml"

Agreed CPS  API(SPI) Exception Hierarchy

(see CCSDK-2871 DP: Long-term Java API(s)

  • CPSValidationException
    • CpsAdminException
      • DataspaceNotFoundException
      • SchemaSetNotFoundException
      • SchemaSetAlreadyDefinedException
    • ModelValidationException
      • SpecificException1
      • SpecificException2
    • DataValidationException
      • SpecificException3
      • SpecificException4
    • PathValidationException
      • SpecificException5

*Note we might have to move these 'common' exceptions classes to the SPI just like we did with the common data objects

Issues & Decisions

#SloganRemarks

Decision

Who &When
1treatment of incorrect dataspace, schemaset (names) These are core concept of CPS and should be correct/exists (except in create use cases of course)
  1. Introduce specific exception for each extending new CPSAdminExcpetion class
  2. re-use same exception in API (pass through)
  3. Treat as bad URL in REST interface
CPS Team Meeting 3 Dec
2Using different HTTP Response code (400 v 404) depending on type of operation, adding data/requesting dataIt might make sense to use 404 Not Found in a get scenario (ie like #3 scenario in the table below) 
But this would be wrong in a create/add data scenario. The API throws the same Exception so the REST Impl would need additional code to handle this distinction

Use 400 Bad requests in both scenarios for the following reasons

  • Consistency 
  • Simplicity of handling in REST Layer
  • HTTP error codes are always ambiguous, we will add documentation for each REST call anyway to specify which errors are used in which scenario
CPS Team Meeting 3 Dec

Vertical slice view of error scenarios


#Use caseScenarioDB (Spring) Response SPI ResponseJava APIREST API Response CodeResponse BodyError Object Message
1Add schema set to dataspace

schema set with same name already exists

DataIntegrityViolationException

SchemaSetAlreadyDefinedException

SchemaSetAlreadyDefinedException400 (bad request)json error objectschema set xyz already defined for dataspace abc
2Add schema set to dataspacedataspacename does not existNo records (Optional, not present)DataspaceNotFoundExceptionDataspaceNotFoundException400 (bad request)json error objectTBD
3List anchors for dataspace namedataspacename does not existNo records (Optional, not present)

DataspaceNotFoundException

DataspaceNotFoundException

400 (bad request)

json error objectdataspace xyz not found
4List anchors for dataspace nameno anchor records in DB0 recordsempty collectionempty collection200 (ok)

empty list

N/A
5







6







7







  • No labels