Bird
0
0

If you run openapi-generator-cli generate -i api.yaml -g spring -o ./client twice without cleaning the output folder, what happens?

medium📝 Predict Output Q5 of 15
Spring Boot - API Documentation
If you run openapi-generator-cli generate -i api.yaml -g spring -o ./client twice without cleaning the output folder, what happens?
AThe generator appends new code to existing files
BThe generator creates duplicate files with suffixes
CThe command fails with a directory not empty error
DThe existing client code is overwritten with the new generated code
Step-by-Step Solution
Solution:
  1. Step 1: Understand default behavior of openapi-generator-cli

    By default, the generator overwrites files in the output directory without appending or creating duplicates.
  2. Step 2: Confirm no error on existing folder

    The tool does not fail due to existing files; it replaces them silently.
  3. Final Answer:

    The existing client code is overwritten with the new generated code -> Option D
  4. Quick Check:

    Re-running generator overwrites output files [OK]
Quick Trick: Generator overwrites existing files by default [OK]
Common Mistakes:
  • Thinking it appends code instead of overwriting
  • Expecting errors on existing output folder
  • Assuming duplicate files are created automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes