pgconfig / api

PGConfig.org API v2
MIT License
48 stars 9 forks source link

Parameter validation returns error for os_type "Windows" #9

Closed GitGraf closed 8 months ago

GitGraf commented 2 years ago

Hi, I noticed that the "os_type" query parameter which can be supplied to https://api.pgconfig.org/v1/tuning/get-config is now required to be in all lower case, otherwise the API returns an error.

GET https://api.pgconfig.org/v1/tuning/get-config?log_format=stderr&max_connections=100&os_type=Windows

{
"errors": {
"code": 500,
"message": "could not process config: could not process rule: Invalid OS"
},
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https://api.pgconfig.org/v1/tuning/get-config?log_format=stderr&max_connections=100&os_type=Windows"
}
}

Changing os_type to "windows" seems to fix the issue.

I strongly believe that v1 of the API (https://github.com/sebastianwebber/pgconfig-api) did not have such a restriction. Should I change my code to match the new validation or will this be considered a bug and fixed?

sebastianwebber commented 8 months ago

fixed in latest release:

❯ curl 'https://api.pgconfig.org/v1/tuning/get-config?log_format=stderr&max_connections=100&os_type=Windows&format=conf'
# Generated by PGConfig 3.1.4 (1fe6d98dedcaad1d0a114617cfd08b4fed1d8a01)
# https://api.pgconfig.org/v1/tuning/get-config?log_format=stderr&max_connections=100&os_type=Windows&format=conf

# Memory Configuration
shared_buffers = 512MB
effective_cache_size = 2GB
work_mem = 5MB
maintenance_work_mem = 102MB

# Checkpoint Related Configuration
min_wal_size = 2GB
max_wal_size = 3GB
checkpoint_completion_target = 0.9
wal_buffers = -1

# Network Related Configuration
listen_addresses = '*'
max_connections = 100

# Storage Configuration
random_page_cost = 4.0
effective_io_concurrency = 2

# Worker Processes Configuration
max_worker_processes = 8
max_parallel_workers_per_gather = 2
max_parallel_workers = 2