Junos Space SDK > Developer Guides > Junos Space Application Developer Guide > Programming with the Junos Space SDK > Using the Junos Space SDK Plug-in > Using the EJB-REST Wizard > REST Wizard Documentation Guide

REST DTO Documentation

Documentation related functionality of DTO pages varies slightly depending on the DTO level. Each DTO page has a Documentation panel with a single text field, which allows you to set a description for the resource, determined by the DTO.






The description is displayed at the top of the resource table inside the Resource Model page.


The Configure DTO Object panel allows you to edit the description for the DTO field or HATEOAS method (in the case of a top-level DTO). To edit a field's description, select the field in the Fields (or Pull-Through Fields) table and click the Edit button to the right of the table. For a primitive field, this action opens the Edit DTO Field Description dialog (see the next section). For an object, you obtain another DTO page, related to a nested DTO. To edit a description for a HATEOAS method, use the Configure Method dialog.

Descriptions of all the fields and methods are displayed in the Description column of the resource table inside the Resource Model page.

Edit Top-Level DTO Field Description Dialog

To open the dialog, switch to the Configure DTO Object panel, select the desired primitive field in the Fields (or Pull-Through Fields) table, and click the Edit button to the right of the table. Enter text into the Description text field.






Description of a primitive field is displayed in the Description column of the resource table inside the Resource Model page.


Nested DTO Page

This page opens when you select an object field of a DTO in the Fields (or Pull-Through Fields) table and click the Edit button to the right of the table. Just like a top-level DTO page, it allows you to edit the description of the corresponding resource (see Dto pages).






However, there is one difference. Descriptions entered this way appear not only at the top of the corresponding resource table inside the Resource Model page, they appear also as a description for the corresponding object field owned by the parent resource, in the usual place inside the parent's resource table.



Configure Method Link Dialog

To open the dialog, switch to the Configure DTO Object panel, select a method link inside the Method Links table, and click the Edit button to the right of the table.




  


The description of a HATEOAS method is displayed in the Description column of the resource table inside the Resource Model page. Note that it is displayed as a String field.



Configuring Defaults and Ranges

When configuring DTO fields, you can also specify default values to be included in the field's description. You can specify defaults for boolean, numeric, string, and enum typed fields. For numeric fields, it is also possible to specify a range. When specifying the default and range for a numeric field, make sure that the minimum value is less than the maximum and that the default is in between the minimum and maximum value

In the following example, the table generated from the State class shows the defaults generation for enum, string, boolean, and long types, as well as the range generated for the long type.