Skip to content

feat: added output.overrides.namingConvention param to orval config, … #2125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dlohvinov
Copy link

@dlohvinov dlohvinov commented May 29, 2025

…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

…added enum functionality depending on namingConvention config param
@dlohvinov dlohvinov marked this pull request as draft May 29, 2025 18:02
@dlohvinov
Copy link
Author

@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 🥲

@melloware melloware requested a review from AllieJonsson May 29, 2025 18:12
@melloware
Copy link
Collaborator

add @AllieJonsson as the most recent committer in this area of code!

@melloware
Copy link
Collaborator

ok looks like the build is failing

@melloware melloware added the enhancement New feature or request label May 29, 2025
@dlohvinov
Copy link
Author

yep, I haven't ran or test it yet. had some issues with packages installation or so, so decided to continue tomorrow.

@melloware
Copy link
Collaborator

@dlohvinov bump?

@dlohvinov
Copy link
Author

@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?

@melloware
Copy link
Collaborator

@dlohvinov just checking in and can you comment on this ticket so I can assign it to you: #2126

@dlohvinov dlohvinov force-pushed the feat/output-override-naming-convention-config-form-enums branch from c19e1fa to a77ada0 Compare June 21, 2025 16:42
@dlohvinov dlohvinov force-pushed the feat/output-override-naming-convention-config-form-enums branch from a77ada0 to e6a6335 Compare June 21, 2025 16:51
@dlohvinov
Copy link
Author

@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', // !!
        },
// ...

@dlohvinov
Copy link
Author

dlohvinov commented Jun 21, 2025

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 🤔

image

@melloware
Copy link
Collaborator

Running build

@dlohvinov dlohvinov marked this pull request as ready for review June 22, 2025 11:05
@dlohvinov
Copy link
Author

@melloware , thanks!
ran reformatting, pushed fix 🙂

@melloware
Copy link
Collaborator

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify generated enum keys
3 participants