davsclaus opened a new pull request, #30022:
URL: https://github.com/apache/camel/pull/30022

   JIRA: [CAMEL-26933](https://issues.apache.org/jira/browse/CAMEL-26933), item 
6.
   
   ## The bug
   
   `camel generate schema --verbose` printed its progress on stdout, before the 
schema:
   
   ```
   $ camel generate schema timer 
org.apache.camel.component.timer.TimerComponent --verbose > s.json
   $ head -3 s.json
   Generating JSON Schema for component: timer
   Class: org.apache.camel.component.timer.TimerComponent
   Camel version: 4.24.0-SNAPSHOT
   ```
   
   so the file was not JSON. A class that is not found printed an empty 
`ERROR:` line and nine more `ERROR:` lines of hints.
   
   ## The fix
   
   - The `--verbose` progress goes to stderr (`printDiagnostic`), so stdout is 
the schema only.
   - After an error line, its hints go to stderr without an `ERROR:` prefix, as 
the download error already did.
   - The class Javadoc lists the real exit codes (0, 1, 2, 3, 70; it listed 
1-4), and its second example uses a class that exists.
   - `camel-jbang-projects.adoc` showed "Schema saved to:" for a command that 
prints the schema on stdout; it now shows `> patient-schema.json`, and says 
what `--output` and `--verbose` do.
   
   ## Tests
   
   `CodeSchemaGeneratorTest` (new). The class comes from the test class path, 
so no component is downloaded:
   - `verboseKeepsStdoutTheSchema`: stdout parses as a JSON schema, and the 
progress is on stderr;
   - `classNotFoundSaysSoOnce`: exit 3, one ERROR line.
   
   Both fail on main. The plugin's tests are green.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to