How should enum arrays and flags expand in URL templates?

Aberta
#898 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
18/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
openapi, python
Domínio
api

Direção de pesquisa

The behaviour lives in RequestInformation query and path expansion in kiota_abstractions/request_information.py, with the enum handling introduced in #223 and kept in #883. Reproduce the four printed URLs from the issue before touching anything. Done would mean the maintainers have stated whether an enum list is an array or a flags value, and any change keeps the non-exploded %2C separator for flags.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

I'd like to clarify the enum-collection contract before proposing a change to request URL construction.

On current main 17b952f81ea2a4d46bb44b6fe6b253578a0cf481, these public calls produce different URLs:

from enum import Enum
from kiota_abstractions.method import Method
from kiota_abstractions.request_information import RequestInformation

class Colour(Enum):
    RED = "red"
    BLUE = "blue"

for values in (["red", "blue"], [Colour.RED, Colour.BLUE]):
    request = RequestInformation(Method.GET, "https://example.com/items{?colour*}")
    request.query_parameters["colour"] = values
    print(request.url)
https://example.com/items?colour=red&colour=blue
https://example.com/items?colour=red%2Cblue

Likewise, {/colour*} produces separate segments for the string list but one comma-joined segment for the enum list. I ran these locally on Windows/CPython 3.13.7; no service call is involved.

For a true array, repeated keys/segments match RFC6570. However, enum joining was introduced in #223 and deliberately preserved in #883, and enum lists can be used as a scalar representation in the form writer. I don't want to remove a flags convention while fixing array expansion.

Could you confirm whether generated query/path enum lists always represent array parameters, or whether they can also represent a single flags enum? If both forms exist, what should distinguish them at URI-template expansion time?

A local proposal that retains the collection makes the array examples work, but also changes non-exploded list separators from %2C to literal commas and normalizes boolean-valued enum elements differently. I'm keeping that runtime change unpublished until the intended contract is clear.

Linguagem predominante
Python
Estrelas
31
Forks
48
Merge médio
16h 36min
PRs com merge (30d)
73

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de microsoft/kiota-python

Todas as issues de microsoft/kiota-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.