aiondemand / AIOD-rest-api

A containerized application using FastAPI and SQLAlchemy connected to a MySQL database.
MIT License
10 stars 7 forks source link

Don't allow empty ("") enums #292

Open AlexJoom opened 4 months ago

AlexJoom commented 4 months ago

An empty string is accepted for an enum. The most appropriate solution would be to silently reject the empty string. I’ve managed to pass this value, along with another valid string, as an array of Scientific Domains for an Organisation (by accident) and it was accepted (on post, “” was sent 7 times, along with “planning and scheduling”). This happened on a fresh and clean local installation of the API. I confirmed by simply doing this afterwards:


curl -X 'GET' \
  'http://localhost:81/scientific_domains/v1' \
  -H 'accept: application/json'

[
  "",
  "planning and scheduling"
]