This PR is second in a series that refactors the way FeatureServer generates the fields property in the responses for requests to FeatureServer/:layer/query and FeatureServer/:layer/.
Key background
The fields property provides metadata for all of the properties/attributes on each feature. For example:
Each property in the feature's attributes is described in the fields array.
As noted above, the layer-info route also returns a fields array. It's almost identical to what is returned in the query endpoint, except that each field includes a nullable and editable boolean field:
Note here that ALL statistics fields with the exception of dates are tagged as type esriFieldTypeDouble regardless of their source field's type. So even if you do a SUM of an integer type, the resulting statistics field is type double. Any groupBy fields are typed as their source field's type.
PR content
This PR contains only the new code used for fields-array generation for the three cases noted above: query, layer-info, query-statistics. You will see that there are two ways field objects can be generated - either from a field definition that is attached the metadata of the provider or by inspecting the data type of a sample value from the feature set.
This PR does not contain the implementation of the new field generation code in the response handler. That will come in a follow-up PR - this is an effort to decrease the scope of each individual PR.
This PR is second in a series that refactors the way FeatureServer generates the
fields
property in the responses for requests toFeatureServer/:layer/query
andFeatureServer/:layer/
.Key background
The
fields
property provides metadata for all of the properties/attributes on each feature. For example:https://services2.arcgis.com/zNjnZafDYCAJAbN0/ArcGIS/rest/services/Street_ROW_Trees/FeatureServer/2/query?resultRecordCount=1&outFields=*&where=1%3D1&f=pjson
Each property in the feature's attributes is described in the
fields
array.As noted above, the layer-info route also returns a
fields
array. It's almost identical to what is returned in the query endpoint, except that each field includes a nullable and editable boolean field:https://services2.arcgis.com/zNjnZafDYCAJAbN0/ArcGIS/rest/services/Street_ROW_Trees/FeatureServer/2?f=pjson
The query endpoint contains one known variation, and this occurs when statistical aggregations have been requested (i.e.,
outStatistics
parameter):statistics query
Note here that ALL statistics fields with the exception of dates are tagged as type
esriFieldTypeDouble
regardless of their source field's type. So even if you do a SUM of an integer type, the resulting statistics field is type double. Any groupBy fields are typed as their source field's type.PR content
This PR contains only the new code used for fields-array generation for the three cases noted above: query, layer-info, query-statistics. You will see that there are two ways field objects can be generated - either from a field definition that is attached the metadata of the provider or by inspecting the data type of a sample value from the feature set.
This PR does not contain the implementation of the new field generation code in the response handler. That will come in a follow-up PR - this is an effort to decrease the scope of each individual PR.