OpenAPI.NET.OData icon indicating copy to clipboard operation
OpenAPI.NET.OData copied to clipboard

Optimization - reusable components for orderby/expand/select query parameters

Open baywet opened this issue 1 year ago • 3 comments

Since #197 was implemented through #499, we have a big opportunity to make descriptions much smaller.

Effectively all operations now have the same definition for those query parameters when they support it

        - name: $orderby
          in: query
          description: Order items by property values
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              type: string
        - name: $select
          in: query
          description: Select properties to be returned
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              type: string
        - name: $expand
          in: query
          description: Expand related entities
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              type: string

When the setting it on, we should do the same thing we do for count/top/skip/filter... and have instead

 - $ref: '#/components/parameters/expand'
 - $ref: '#/components/parameters/select'
 - $ref: '#/components/parameters/orderby'

Which would save a ton of repetition throughout the final description.

baywet avatar Nov 28 '24 14:11 baywet

I would request that we do not do this. This will cause us to lose the valuable information of which properties can be sorted, expanded and filtered.

darrelmiller avatar Nov 28 '24 14:11 darrelmiller

@darrelmiller the component aspect would only happen when the UseStringArrayForQueryOptionsSchema conversion setting added in #499 is set to true, where the enum values are already gone, so this change would not "loose any more information". It would not happen when the setting is false. In which case we maintain the enum values.

baywet avatar Nov 28 '24 16:11 baywet

Fine. We can defer the fight to choosing what value we should use for UseStringArrayForQueryOptionsSchema :-)

darrelmiller avatar Dec 11 '24 01:12 darrelmiller