How to access request type in RAML file (using webapi-parser)

185 views Asked by At

Library used webapi-parser 0.5.0

Language library used with Java

Describe the issue I am unable to find a method to access the type of request defined in the raml file

Input you have issues with Below is the relavent section of RAML file

/testEndpoint:
      type: rt.Item
      post:
        is: [t.ReturnsItemCreated, t.ExpectsContext, t.ReturnsNotFound, t.ReturnsBadGateway, t.ReturnsCommonErrors, t.NotCacheable]
        body:
          application/json:
            type: bu.BlockCodeUpdatesRequestType
            examples:
              de-cards-bc: !include examples/example1.json
        responses:
          201:
            body:
              application/json:
                type: bu.DeviceManagementResponseType
                example: !include examples/ex2.json   

Code you have issues with After going through the documentation, I tried using operation.request().payloads().get(0).mediaType().value() but that returns application/json which isn't what I want, I want the type inside the application/json i.e. bu.BlockCodeUpdatesRequestType. Same is the case with the examples, I am unable to read those, the payloads().get(0).examples() comes up as empty for some reason and I don't know to access these. Getting just the path in the examples is enough.

Additional context The variables like rt bu are RAML library files defined under uses:

I asked the same thing on Github here.

0

There are 0 answers