Forums / SmartComponent Library - Developer Forum / Rest annotations and parameter classes

Rest annotations and parameter classes

4 posts, 1 answered
  1. Chuck Bensinger
    Chuck Bensinger avatar
    2 posts
    Registered:
    23 Aug 2019
    08 Apr
    Link to this post
    When using a parameter class with a REST annotation is it possible to not make all of the properties in the parameter class required?  We use a parameter class with quite a few properties in conjunction with our ItemBusinessEntity, but only a couple of those properties need to be required for what we are doing.

    Thanks.
  2. Mike Fechner
    Mike Fechner avatar
    263 posts
    Registered:
    14 Sep 2016
    08 Apr in reply to Chuck Bensinger
    Link to this post
    Can you please describe the issue you are facing a bit more in detail? 

    I don't think we have any concept of mandatory properties in parameter objects. Are you referring to @RestMethod or @InvokeMethod parameters? 
  3. Chuck Bensinger
    Chuck Bensinger avatar
    2 posts
    Registered:
    23 Aug 2019
    08 Apr
    Link to this post
    We have the following:

    @RestMethod (address="/Item/~{UpcNum}~{PackNum}/GetItem", requestMethod="get", parameterClassName="Osprey.Pos.Item.ItemParameter", response="poItemParameter").

    METHOD PUBLIC VOID GetItem ( INPUT-OUTPUT DATASET-HANDLE phDset, poItemParameter AS Osprey.Pos.Item.ItemParameter  ):

    We have several properties in the ItemParameter class, but in this case we are only using two values from it, UPCNum and PackNum.  

    When I load up Swagger and look at this GetItem, I see all of the properties from ItemParameters listed as (query) and marked as "* required".

    Swagger Screenshot
    Last modified on 08 Apr 2021 20:04 by Chuck Bensinger
  4. Mike Fechner
    Mike Fechner avatar
    263 posts
    Registered:
    14 Sep 2016
    Answered
    09 Apr in reply to Chuck Bensinger
    Link to this post
    That sounds like an issue in the SwaggerFile. 

    But the backend will accept calls with those properties missing. 
4 posts, 1 answered