molybdenum-99 / tlaw

The Last API Wrapper: Pragmatic API wrapper framework
MIT License
125 stars 9 forks source link

Range enum #22

Closed marcandre closed 4 years ago

marcandre commented 5 years ago

This PR improves handling of param :foo, enum: 1..1000. It also allows float enums.

This builds on #21; only the last commit is new.

Note: it's not clear to me why the API allows type: {a: 1}, enum: {a: 1} and enum: 1..42 but not type: 1..42. I find this inconsistent and would suggest to either allow it, or forbid type: {...}. This PR doesn't address this.

marcandre commented 5 years ago

I don't plan on rebasing this PR in the near future.

zverok commented 5 years ago

I understand. I'll take a look into a possible API for ranges myself. After the refactoring is complete, I need to think about further directions for the library. Really want to keep things tidy, it is already overthought at some points (for ex., response processing, as discussed here) and I feel like param(...) DSL API starts to get out of hand, becoming one more of thousands of "typed attr DSL for Ruby" already in presence.