Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,20 @@ dotnet run --project src/Refitter --configuration Release --framework net9.0 --
## Common Development Tasks

### Adding New CLI Options
1. Update `src/Refitter/GenerateCommand.cs` with new command-line arguments
2. Add corresponding property to `src/Refitter.Core/Settings/RefitGeneratorSettings.cs`
3. Implement logic in `src/Refitter.Core/RefitInterfaceGenerator.cs`
4. Add unit tests in `src/Refitter.Tests/Examples/`
5. Update README.md documentation
1. Add new property to `src/Refitter/Settings.cs` with `[CommandOption("--option-name")]` attribute
2. Update `CreateRefitGeneratorSettings()` method in `src/Refitter/GenerateCommand.cs` to map the setting
3. Add corresponding property to `src/Refitter.Core/Settings/RefitGeneratorSettings.cs`
4. Implement logic in `src/Refitter.Core/RefitInterfaceGenerator.cs` or related generator classes
5. Add unit tests in `src/Refitter.Tests/Examples/` following the established pattern
6. Update README.md documentation with the new option

### Recent CLI Options Added
- `--use-apizr`: Integration with Apizr library for request options
- `--use-dynamic-querystring-parameters`: Enable dynamic query string parameter wrapping
- `--use-polymorphic-serialization`: Use System.Text.Json polymorphic serialization
- `--disposable`: Generate IDisposable clients
- `--collection-format`: Control query parameter collection formatting (Multi/Csv/Ssv/Tsv/Pipes)
- `--no-banner`: Hide donation banner in CLI output

### Working with OpenAPI Specifications
- Test resources are located in `src/Refitter.Tests/Resources/V2/` and `src/Refitter.Tests/Resources/V3/`
Expand All @@ -155,14 +164,25 @@ dotnet run --project src/Refitter --configuration Release --framework net9.0 --
- Use meaningful variable and method names
- Keep methods focused with single responsibility

### UI and Console Output
- CLI uses **Spectre.Console** for rich terminal output with colors, tables, and panels
- ASCII art banner is displayed on startup (can be disabled with `--no-banner`)
- Progress indicators and formatted tables show generation status and file information
- Error handling includes styled panels and structured exception display
- Support key display for troubleshooting (disabled when `--no-logging` is used)

## Build and CI/CD Information

### GitHub Workflows
- **build.yml**: Main build workflow (builds and tests)
- **smoke-tests.yml**: Quick validation tests
- **release.yml**: Automated releases
- **release-preview.yml**: Preview releases
- **docfx.yml**: Documentation generation
- **msbuild.yml**: MSBuild-specific testing
- **regression-tests.yml**: Regression testing against known scenarios
- **production-tests.yml**: Production environment testing
- **codecov.yml**: Code coverage reporting

### Expected Build Times
- Package restore: ~65 seconds
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ EXAMPLES:
refitter ./openapi.json --optional-nullable-parameters
refitter ./openapi.json --use-polymorphic-serialization
refitter ./openapi.json --collection-format Csv
refitter ./openapi.json --simple-output

ARGUMENTS:
[URL or input file] URL or file path to OpenAPI Specification file
Expand Down Expand Up @@ -103,6 +104,7 @@ OPTIONS:
--keep-schema Force to keep matching schema, uses regular expressions. Use together with "--trim-unused-schema". Can be set multiple times
--include-inheritance-hierarchy Keep all possible inherited types/union types even if they are not directly used
--no-banner Don't show donation banner
--simple-output Generate simple, plain-text console output without ASCII art, tables, emojis, or color formatting (suitable for IDE output windows)
--skip-default-additional-properties Set to true to skip default additional properties
--collection-format Multi Determines the format of collection parameters. May be one of Multi, Csv, Ssv, Tsv, Pipes
--operation-name-generator Default The NSwag IOperationNameGenerator implementation to use.
Expand Down Expand Up @@ -146,6 +148,28 @@ Here's what the console output looks like when running the Refitter CLI tool:

![Console Output](images/console-output.png)

### Simple Output Mode

For integration with IDEs and build tools that don't support rich console formatting, Refitter provides a `--simple-output` option:

```shell
refitter ./openapi.json --simple-output
```

This mode generates plain text output without:

- ASCII art and banners
- Colored text and rich formatting
- Unicode characters and emojis
- Tables and panels

This is particularly useful when:

- Running Refitter from Visual Studio extensions
- Integrating with build systems that capture console output
- Using tools that don't support ANSI escape sequences
- Running in environments with limited console capabilities

## Source Generator

Refitter is available as a C# Source Generator that uses the [Refitter.Core](https://github.com/christianhelle/refitter/tree/main/src/Refitter.Core) library for generating a REST API Client using the [Refit](https://github.com/reactiveui/refit) library. Refitter can generate the Refit interface from OpenAPI specifications. Refitter could format the generated Refit interface to be managed by [Apizr](https://www.apizr.net) and generate some registration helpers too.
Expand Down
2 changes: 2 additions & 0 deletions docs/docfx_project/articles/cli-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ EXAMPLES:
refitter ./openapi.json --optional-nullable-parameters
refitter ./openapi.json --use-polymorphic-serialization
refitter ./openapi.json --collection-format Csv
refitter ./openapi.json --simple-output

ARGUMENTS:
[URL or input file] URL or file path to OpenAPI Specification file
Expand Down Expand Up @@ -83,6 +84,7 @@ OPTIONS:
--include-inheritance-hierarchy Keep all possible inherited types/union types even if they are not directly used
--no-banner Don't show donation banner
--skip-default-additional-properties Set to true to skip default additional properties
--simple-output Generate output with no color, no formatting, no emojis, and no banners suitable for terminal or IDE output
--collection-format Multi Determines the format of collection parameters. May be one of:
- Multi (separate parameter instances for each array item)
- Csv (comma separated values)
Expand Down
Loading
Loading