Skip to content

Commit

Permalink
Merge pull request #22 from christianhelle/release-v0.4.2
Browse files Browse the repository at this point in the history
Release v0.4.2
  • Loading branch information
christianhelle authored Apr 24, 2023
2 parents b14e856 + a957fcf commit 0aeb0e9
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "release"

env:
VERSION: 0.4.1
VERSION: 0.4.2
NUGET_REPO_URL: "https://api.nuget.org/v3/index.json"

jobs:
Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,29 @@ $ refitter --help

```
USAGE:
refitter [URL or file path] [OPTIONS]
refitter [URL or input file] [OPTIONS]
EXAMPLES:
refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode" --output ./Output.cs
refitter ./openapi.json
refitter https://petstore3.swagger.io/api/v3/openapi.yaml
refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode" --output ./GeneratedCode.cs
refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode" --internal
refitter ./openapi.json --output ./IGeneratedCode.cs --interface-only
refitter ./openapi.json --use-api-response
ARGUMENTS:
[URL or file path] URL or file path to OpenAPI Specification file
[URL or input file] URL or file path to OpenAPI Specification file
OPTIONS:
DEFAULT
-h, --help Prints help information
-n, --namespace GeneratedCode Default namespace to use for generated types
-o, --output Output.cs Path to Output file
--no-auto-generated-header Don't add <auto-generated> header to output file
--interface-only Don't generate contract types
--use-api-response Return Task<IApiResponse<T>> instead of Task<T>
DEFAULT
-h, --help Prints help information
-n, --namespace GeneratedCode Default namespace to use for generated types
-o, --output Output.cs Path to Output file
--no-auto-generated-header Don't add <auto-generated> header to output file
--interface-only Don't generate contract types
--use-api-response Return Task<IApiResponse<T>> instead of Task<T>
--internal Set the accessibility of the generated types to internal
(default: public)
```

To generate code from an OpenAPI specifications file, run the following:
Expand Down
71 changes: 59 additions & 12 deletions src/Refitter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,65 @@

var app = new CommandApp<GenerateCommand>();
app.Configure(
config => config
.SetApplicationName("refitter")
.SetApplicationVersion(typeof(GenerateCommand).Assembly.GetName().Version!.ToString())
.AddExample(
new[]
{
"./openapi.json",
"--namespace",
"\"Your.Namespace.Of.Choice.GeneratedCode\"",
"--output",
"./Output.cs"
}));
config =>
{
var configuration = config
.SetApplicationName("refitter")
.SetApplicationVersion(typeof(GenerateCommand).Assembly.GetName().Version!.ToString());

configuration
.AddExample(
new[]
{
"./openapi.json",
});

configuration
.AddExample(
new[]
{
"https://petstore3.swagger.io/api/v3/openapi.yaml"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--namespace",
"\"Your.Namespace.Of.Choice.GeneratedCode\"",
"--output",
"./GeneratedCode.cs"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--namespace",
"\"Your.Namespace.Of.Choice.GeneratedCode\"",
"--internal"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--output",
"./IGeneratedCode.cs",
"--interface-only"
});

configuration
.AddExample(
new[]
{
"./openapi.json",
"--use-api-response"
});
});
return app.Run(args);

internal sealed class GenerateCommand : AsyncCommand<GenerateCommand.Settings>
Expand Down

0 comments on commit 0aeb0e9

Please sign in to comment.