Skip to content
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

fix(core): Fixed condition for using barrel import in split-tags mode #1122

Merged

Conversation

soartec-lab
Copy link
Member

Status

READY

Description

Due to the changes in this PR, barrel is no longer used for import of schema files when the following conditions are met:

  • tags-split is specified for mode
  • specified schemas

It looks like you are expecting barrel to not be used for import of schema if indexFiles is false.

But, as a result, barrel is no longer used for import of schema files even if the value of indexFiles is true. Incidentally, by default the value of indexFiles is true.

I made a small change because if indexFiles is true, I want to use barrel for import as before.

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

when indexFiles is false, barrel is not used for import of schema

  1. Specify false for indexFiles in orval.config.js as shown below:
module.exports = {
  'petstore-file': {
    input: {
      target: './petstore.yaml'
    },
    output: {
      mode: 'tags-split',
      target: "src/gen/endpoints",
      schemas: "src/gen/model",
      indexFiles: false
    }
  },
};
  1. orval execution
yarn orval
  1. barrel is not used in gen/endpoints/pets/pets.ts
import type {
  ListPetsParams
} from '../../model/listPetsParams'
import type {
  Pet
} from '../../model/pet'
import type {
  Pets
} from '../../model/pets'

when indexFiles is true, barrel is used for import of schema

  1. Specify true for indexFiles in orval.config.js as shown below:
module.exports = {
  'petstore-file': {
    input: {
      target: './petstore.yaml'
    },
    output: {
      mode: 'tags-split',
      target: "src/gen/endpoints",
      schemas: "src/gen/model",
      indexFiles: true,
    }
  },
};
  1. orval execution
yarn orval
  1. barrel is used in gen/endpoints/pets/pets.ts
import type {
  ListPetsParams,
  Pet,
  Pets
} from '../../model'

melloware
melloware previously approved these changes Dec 28, 2023
@melloware melloware added the bug Something isn't working label Dec 28, 2023
@melloware melloware added this to the 6.24.0 milestone Dec 28, 2023
@soartec-lab
Copy link
Member Author

Thank you for the review. Oops, format is an error so I'll fix this.

@soartec-lab
Copy link
Member Author

@melloware
CI was failing so I fixed it. Please check again 🙌

@melloware melloware merged commit 0a747c7 into orval-labs:master Dec 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants