@@ -28,6 +28,29 @@ pub enum OxideOverride {
2828 Table { table : Box < Mutex < TableFormatter > > } ,
2929}
3030
31+ /// Format response values into a table.
32+ ///
33+ /// This works as follows:
34+ ///
35+ /// 1. Get the `schemars` schema of the endpoint's return type. For the endpoints we support
36+ /// tabular output for, this will always be a JSON object.
37+ ///
38+ /// 2. Parse the schema and determine the parameters of the object being returned. The column
39+ /// names displayed will be the parameters of the return object.
40+ ///
41+ /// 3. Handle different return types:
42+ /// - **Non-paginated scalar objects**: Use directly.
43+ /// - **Non-paginated array object**: Extract the inner type of the array.
44+ /// - **Paginated output**: Extract the inner type of the collection.
45+ /// - **Enums**: Take the union of parameter names across all variants. Fields not present
46+ /// for a given variant will be blank.
47+ ///
48+ /// 4. Apply field filtering if requested by the user. Take the intersection of their list
49+ /// and the available fields.
50+ ///
51+ /// 5. Format values for display:
52+ /// - Non-scalar objects are printed as compact JSON.
53+ /// - Strings without any spaces have their quotes stripped.
3154pub struct TableFormatter {
3255 requested_fields : Vec < String > ,
3356 fields_to_print : Vec < String > ,
0 commit comments