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

$expand is reported as enum while it is actually string

Open sherlock1982 opened this issue 2 years ago • 1 comments

Current behavior: $expand is enum.

Expected behavior: $expand is string because you can have complex expressions in $expand like for example $expand=Groups($expand=Members)

sherlock1982 avatar Mar 11 '22 08:03 sherlock1982

If we updated the schema to be like this it would allow us to provide a list of properties that are expandable but also indicate that each expand property could be a more complex syntax.

          schema:
            uniqueItems: true
            type: array
            items:
              anyOf:
                - enum:
                    - '*'
                    - serviceAnnouncement
                - type: string

Thoughts?

darrelmiller avatar Aug 18 '22 14:08 darrelmiller

adding some more context here due to https://github.com/microsoft/kiota/pull/4265 https://github.com/microsoftgraph/msgraph-sdk-typescript/pull/512

currently expand, orderby, select are projected as arrays of enums. In all three cases this is wrong because of nested expands/selects and nested properties ordering

e.g. $expand=Groups($expand=Members) $select=manager($select=firstName) $orderBy=manager.firstName

projecting all possibilities for all sub-properties combinations would lead to huge and hard to read enums projecting only the first level properties like today is constraining. projecting only the first level sub-properties with a oneOf with a string (variation of what Darrel proposed) I believe will lead to confusion (is this only what's supported?), won't be useful for validation or code generation purposes.

I propose we simply project those three as arrays of strings instead. Which will have the additional benefit of making Microsoft Graph descriptions quite smaller too.

baywet avatar Feb 29 '24 13:02 baywet

We do have a hard dependency on that though, GE relies on this to auto completion. We need to tie this new behaviour to a conversion setting switch (true by default, false for GE) "EmitExpandSelectAndOrderByAsStrings" (or a better name)

baywet avatar Feb 29 '24 13:02 baywet

I propose we simply project those three as arrays of strings instead. Which will have the additional benefit of making Microsoft Graph descriptions quite smaller too.

+1

andrueastman avatar Feb 29 '24 14:02 andrueastman