Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


DescriptionExample
1Change resource Identifier from a path param to a query param in the openapi.yml
Sample of url
ncmp/passthorough:Operational?resourceIdentifer=turingmachine:turingmachine/xyz/abc&query={depth=6,fields=abc/x/y/c}


Sample of definiton in openapi.yaml
resourceIdentifierInPath
:
name: resourceIdentifier
in: query
description: Resource identifier to get/set the resource data
required: true
schema:
type: string
2Keep it as path param also but we need to assume that all values after this slash belong to this resource only

/passthorough:Operational/{resource-identifier: .+}.


As it is single param and if you enter the value by url encoding then you have to change spring HttpFirewall 

 final StrictHttpFirewall firewall = new StrictHttpFirewall();
        firewall.setAllowUrlEncodedSlash(true);
3Create a method in the controller without using open api


Code Block
languagejava
    @RequestMapping(value = "/v1/ch/{cmHandle}/data/ds/ncmp-datastore:passthrough-running/**",
        produces = {"application/json"},
        consumes = {"application/json"},
        method = RequestMethod.PUT)
    public ResponseEntity<Object> getResourceDataPassthroughRunningForCmHandle(
        @PathVariable("cmHandle") String cmHandle, HttpServletRequest resourceIdentifier
        ,@RequestBody DataAccessReadRequest body,
        @RequestHeader(value = "accept", required = false) String accept
        ,@RequestParam(value = "fields", required = false) String fields
        , @Min(1) @Valid @RequestParam(value = "depth", required = false) Integer depth
    ) {
        final var modulesListAsJson = dmiService.getResourceDataPassThroughRunningForCmHandle(cmHandle,
            resourceIdentifier.toString(),
            accept,
            fields,
            depth,
            body.getCmHandleProperties());
        return ResponseEntity.ok(modulesListAsJson);
    }


...