orval
orval copied to clipboard
feat: added output.overrides.namingConvention param to orval config, …
…added enum functionality depending on namingConvention config param
Status
WIP
Fix #2126 Fix #2120
Description
Added output.overrides.namingConvention -> output.overrides.namingConvention.enum config options and implemented generated enum keys conversion depending on this config parameter.
Related PRs
--
Todos
- [ ] Implement feature
- [ ] Test feature manually
- [ ] Tests
- [ ] Documentation
- [ ] Changelog Entry (unreleased)
Steps to Test or Reproduce
// TODO
@melloware FYI, based on this discussion I've written feature code, but haven't tested it yet. So, now creating a draft PR. Still working on it.
Also, writing this new config parameter as 6th function parameter looks like a bad idea to me, but I didn't came up with a better solution considering existing params 🥲
add @AllieJonsson as the most recent committer in this area of code!
ok looks like the build is failing
yep, I haven't ran or test it yet. had some issues with packages installation or so, so decided to continue tomorrow.
@dlohvinov bump?
@melloware, yep, I remember. Sorry, I'm having too much job workload and just haven't had enough time yet 🫠🫠 Anyway, I'm still planning to continue and complete this PR.
Are there any other issues or feature requests related to this feature and it would be great for me to speed up, or I can take some time?
@dlohvinov just checking in and can you comment on this ticket so I can assign it to you: https://github.com/orval-labs/orval/issues/2126
@melloware , hi! I've:
- fixed type errors which were causing build errors,
- tested manually,
- added a unit test
Had some issues with package installation, generated samples formatting, so I'm not sure, should I commit my manual testing diffs.
Manually I've tested using samples/basic.
I've commented 'petstore-file' orval.config.ts entry, and added my config param to petstore-file-transfomer
// samples/basic/orval.config.ts
export default defineConfig({
/*
not sure why, but 2nd config entry override didn't work
without commenting 1nd entry (guess, that's not a bug but I'm just lucking understanding, yet) 🤔
'petstore-file': {
input: './petstore.yaml',
output: './api/endpoints/petstoreFromFileSpecWithConfig.ts',
},
*/
'petstore-file-transfomer': {
output: {
// ...
override: {
namingConvention: {
enum: 'PascalCase', // !!
},
// ...
btw, key "People's_Republic_of_China" converts to PeopleSRepublicOfChina.
again, not sure if this is correct, but I've used already existing conventionName function, so, guess this is rather a utility function issue 🤔
Running build
@melloware , thanks! ran reformatting, pushed fix 🙂
Looking good now I think all you need to do is update the /docs for this new configuration explaining the options and what it does!
@melloware , thanks! Added docs.
Btw, had some issues with md links: output.namingConvention conflicts with output.override.namingConvention, so I've added cringy "for property keys" to my docs entry title. Not sure about this decision 😬
What do you think, maybe should I rename config param, or change title like:
namingConvention -> override/namingConvention? 🤔
@melloware, thanks! So, what are the next steps?
thanks for the reminder. Merged!
great, thank you! ❤️