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

New $count endpoints in OpenAPI missing parameters

Open calebkiage opened this issue 3 years ago • 9 comments

Short summary (3-5 sentences) describing the issue. Some endpoint paths e.g. /users require the ConsistencyLevel header defined. This is shown by having the header added in the operation parameters as shown below: image The new $count endpoints e.g. /users/$count don't have the parameters defined in the OpenAPI schema file: image

Assemblies affected

Which assemblies and versions are known to be affected? Unknown, but the openapi file generated in commit microsoftgraph/msgraph-metadata@e7568c69 is affected

Steps to reproduce

The simplest set of steps to reproduce the issue. If possible, reference a commit that demonstrates the issue.

Expected result

What would happen if there wasn't a bug. The $count endpoints should list the required headers like ConsistencyLevel in the schema

Actual result

What is actually happening. There is no header parameter in the schema

Additional detail

*Optional, details of the root cause if known.

calebkiage avatar Apr 06 '22 17:04 calebkiage

considering the entity set has an annotation to indicate the header is present, it should propagate to the raw count endpoint.

now the question is: should it propagate to OData type cast path segments as well? navigation properties? the index endpoint users/id ? If so for which operations? ping @darrelmiller to bring clarity on this.

<Annotations Target="microsoft.graph.GraphService/directoryObjects">
        <Annotation Term="Org.OData.Capabilities.V1.ReadRestrictions">
          <Record>
            <PropertyValue Property="CustomHeaders">
              <Collection>
                <Record>
                  <PropertyValue Property="Name" String="ConsistencyLevel" />
                  <PropertyValue Property="Description" String="Indicates the requested consistency level." />
                  <PropertyValue Property="DocumentationURL" String="https://developer.microsoft.com/en-us/office/blogs/microsoft-graph-advanced-queries-for-directory-objects-are-now-generally-available/" />
                  <PropertyValue Property="Required" Bool="false" />
                  <PropertyValue Property="ExampleValues">
                    <Collection>
                      <Record>
                        <PropertyValue Property="Value" String="eventual" />
                        <PropertyValue Property="Description" String="$search and $count queries require the client to set the ConsistencyLevel HTTP header to 'eventual'." />
                      </Record>
                    </Collection>
                  </PropertyValue>
                </Record>
              </Collection>
            </PropertyValue>
          </Record>
        </Annotation>
      </Annotations>

baywet avatar May 19 '22 12:05 baywet

Currently AGS strips off the ReadRestrictions that are added by the workload team and we add them back manually in the XSLT. The Identity Graph team are currently implementing a mechanism to allow us to access the unfiltered metadata which will give us all of these annotations without us having to manually add them back. We should wait until this work is done, rather than updating the XSLT.

darrelmiller avatar May 19 '22 13:05 darrelmiller

and to clarify, we shouldn't either propagate that information automatically?

baywet avatar May 19 '22 14:05 baywet

Reviving this as it affects https://github.com/microsoftgraph/msgraph-metadata/issues/185.

To @baywet's question, should we propagate the header to OData type cast path segments, navigation properties, and index endpoint? I would say yes since this is how the the header is used. See AAD advanced queries. I have a branch in the metadata repo that adds the header to supported navigation properties via XSLT. The supported navigation properties are extracted from AAD advanced queries.

@darrelmiller, the metadata with ReadRestrictions from AGS does not currently have the header applied to supported navigation properties. This will need to be added by the workload to fix https://github.com/microsoftgraph/msgraph-metadata/issues/185 if we are to use AGS's metadata.

peombwa avatar Jul 11 '22 22:07 peombwa

Thanks. But then the propagation should be limited to get opérations, correct?

baywet avatar Jul 12 '22 11:07 baywet

@peombwa We should go and ask Luca to add the metadata for those navigation properties and we need to update the metadata processing scripts to use the new metadata instead of the $metadata endpoint.

@baywet The new metadata in the schemas folder is unfiltered. I don't know what other capability annotations AGS was previously removing. I only know for sure about ReadRestrictions.

darrelmiller avatar Jul 12 '22 13:07 darrelmiller

@timayabi2020 what's the rationale behind closing this?

baywet avatar Jul 14 '22 12:07 baywet

@baywet apologies I might have closed it by mistake from the powershell project board.

timayabi2020 avatar Jul 21 '22 20:07 timayabi2020

Dependent on this issue https://github.com/microsoftgraph/msgraph-metadata/issues/203

darrelmiller avatar Sep 06 '22 13:09 darrelmiller