API: OpenAPI schema does not match live responses (breaks strict output validation)

Aperta
#7,679 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
openapi, python

Direzione di ricerca

Inizia con il /api/v1/swagger.json pubblicato e confronta gli schemi degli endpoint elencati di paginazione, restituzione di array, risorse esterne delle feature, owners e group_owners con le relative risposte live. Usa il crawl degli endpoint di lettura contrassegnato con MCP e la validazione dell’output di FastMCP from_openapi come percorso di verifica; il lavoro è completato quando gli schemi dichiarati convalidano tali risposte, così validate_output può essere riabilitato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The published OpenAPI schema (/api/v1/swagger.json) disagrees with actual API responses in several systematic ways. Any client that validates responses against the schema (e.g. the Flagsmith MCP server, which uses FastMCP's from_openapi output validation) fails on most endpoints. Found by crawling the MCP-tagged read endpoints against SaaS and validating each response against its declared schema.

1. Pagination next/previous typed string, returned null

Paginated responses declare next and previous as non-nullable string, but the API returns null when there is no adjacent page. Should be string, nullable (anyOf: [string, "null"]).

Affected: list_organizations, list_organization_groups, list_organization_invites, list_organization_roles, list_environments, list_project_features, list_project_segments, list_project_change_requests, list_feature_multivariate_options, list_feature_segments, get_environment_feature_versions (likely all paginated list endpoints).

2. Array-returning endpoints declared as a single object

The 200 response schema is the singular item serializer, but the endpoint returns a JSON array. Should be type: array, items: <object>.

  • GET /organisations/{id}/projects/ (list_projects_in_organization)
  • GET /projects/{id}/environments/ (list_project_environments)
  • GET /projects/{project_pk}/features/{feature_pk}/code-references/
  • GET /projects/{project_pk}/features/{id}/evaluation-data/
3. get_feature_external_resources: missing count

GET …/feature-external-resources/ returns {"results": []} but the schema marks count as required. Either the response should include the full pagination envelope or the schema should not require count.

4. owners / group_owners typed as integer IDs but expanded in responses

Read responses expand these to nested user objects ({id,email,first_name,last_name,last_login,uuid}), while the schema types them as array<integer>. Affects get_feature_flag and list_project_features (results[].owners[]); likely anywhere a feature is serialised for read.

Impact / workaround

The MCP server currently sets validate_output=False to avoid rejecting valid responses. We'd like to re-enable output validation once the schema matches reality.

Lingua principale
Python
Stelle
9.9k
Fork
658
Merge medio
1g 15h
PR unite (30g)
168

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Flagsmith/flagsmith

Tutte le issue di Flagsmith/flagsmith

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.