Carry OpenAPI numeric constraints into CLI flags#108
Conversation
Greptile SummaryThis PR carries OpenAPI numeric constraints (
Confidence Score: 5/5Safe to merge — all changed paths are additive, well-tested, and the new number parser is guarded correctly for empty input, non-finite values, and out-of-range bounds. The changes are purely additive: new fields on an existing interface, a new custom flag parser, and a regenerated artifact. The parser correctly handles every edge case (empty string, whitespace, Infinity/NaN, min/max bounds), and the test suite exercises all of those branches including both lower- and upper-bound rejection. No existing behavior is removed or altered in a breaking way. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Apply numeric constraints to body flags" | Re-trigger Greptile |
Summary
Carries scalar parameter metadata from the OpenAPI spec into the generated operation manifest, then uses it when building generated CLI flags.
default,minimum, andmaximummetadata toPrimitiveParameterManifest.operations.generated.tsso listlimitparams expose theirdefault/min/maxvalues.min,max, and numericdefaultthrough toFlags.integer.numberflag parser so futuretype: numberparams can validate min/max client-side too.This keeps generated commands from accepting obviously out-of-range numeric values that the OpenAPI spec already describes.
Validation
pnpm --filter @primitivedotdev/api-core generate:openapipnpm --filter @primitivedotdev/cli test -- tests/oclif/api-command.test.tspnpm --filter @primitivedotdev/cli typecheckpnpm --filter @primitivedotdev/cli lintgit diff --check