Skip to content

Commit

Permalink
feat: add version parameter to allow version override (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
M3lkior authored Feb 17, 2021
1 parent e038aec commit 462d64b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ npm install -g @asyncapi/generator

## Supported parameters

|Name|Description|Required|Default|Example|
|---|---|---|---|---|
|outFilename|The filename of the output file.|No|`asyncapi.md`|`index.md`|
|Name|Description|Required|Default|Allowed values|Example|
|---|---|---|---|---|---|
|outFilename|The filename of the output file.|No|`asyncapi.md`|*Any* with `.md` extension|`index.md`|
|version|Override the version of your application provided under `info.version` location in the specification file.|No|Version is taken from the specification file.|Version is taken from the spec file. |`1.0.0`|


## Development

Expand Down
4 changes: 2 additions & 2 deletions components/Info.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Text } from "@asyncapi/generator-react-sdk";

import { Header, Link, Image } from "./common";

export function Info({ asyncapi }) {
export function Info({ asyncapi, params }) {
const info = asyncapi.info();
return (
<>
<Header type={1}>
{info.title()} {info.version()} documentation
{info.title()} {params.version || info.version()} documentation
</Header>

{info.description() && (
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
"description": "The name of the output markdown file",
"default": "asyncapi.md",
"required": false
},
"version": {
"description": "Override the version of your application provided under `info.version` location in the specification file.",
"required": false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion template/asyncapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Channels } from "../components/Channels";
export default function({ asyncapi, params }) {
return (
<File name={params.outFilename || 'asyncapi.md'}>
<Info asyncapi={asyncapi} />
<Info asyncapi={asyncapi} params={params} />
<TableOfContents asyncapi={asyncapi} />
<TermsOfService asyncapi={asyncapi} />
<Servers asyncapi={asyncapi} />
Expand Down

0 comments on commit 462d64b

Please sign in to comment.