microsoft / microsoft/OpenAPI.NET.OData

orderby/select/expand should be oneOf when UseStringArrayForQueryOptionsSchema is false

Open
#615 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

priority:p1 type:bug
Dominant language
C#
Stars
240
Forks
70
Avg merge
7h 59m
Merged PRs (30d)
13

Description

Currently we describe


parameters:
  - name: $select
    in: query
    style: form
    explode: false
    schema:
      uniqueItems: true
      type: array
      items:
        type: string
        enum:
          - id
          - firstName
          - ....

It should instead be


parameters:
  - name: $select
    in: query
    style: form
    explode: false
    schema:
      uniqueItems: true
      type: array
      items:
        oneOf:
        - type: string
        - type: string
           enum:
             - id
             - firstName
             - ....

This is because for any navigation property you can write $select=navProperty($expand=subproperty) and we don't want to project all possibilities. But we don't want to restrict clients to simply the scalar/first level properties.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating UseStringArrayForQueryOptionsSchema and the schema generation for $select, $orderby, and $expand. Compare the current generated OpenAPI schema with the issue's examples; done means navigation-property expressions remain possible while scalar and first-level properties are represented through the requested oneOf structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.