-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: externalDocumentation rendered for tags, operations and schema …
…fields (#595) The externalDocs were missing for tags, schemata and operations. Added them with this pull requests. Solves #550. Additionally, fixes that the URL in External Documentation Object was specified to be optional, which is not correct according to OpenAPI spec.
- Loading branch information
1 parent
4b3b5ba
commit 893c83e
Showing
13 changed files
with
71 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/components/ExternalDocumentation/ExternalDocumentation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { observer } from 'mobx-react'; | ||
import * as React from 'react'; | ||
import styled, { withProps } from '../../styled-components'; | ||
import { OpenAPIExternalDocumentation } from '../../types'; | ||
import { linksCss } from '../Markdown/styled.elements'; | ||
|
||
const LinkWrap = withProps<{ compact?: boolean }>(styled.div)` | ||
${linksCss}; | ||
${({ compact }) => (!compact ? 'margin: 1em 0' : '')} | ||
`; | ||
|
||
@observer | ||
export class ExternalDocumentation extends React.Component<{ | ||
externalDocs: OpenAPIExternalDocumentation; | ||
compact?: boolean; | ||
}> { | ||
render() { | ||
const { externalDocs } = this.props; | ||
if (!externalDocs || !externalDocs.url) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<LinkWrap compact={this.props.compact}> | ||
<a href={externalDocs.url}>{externalDocs.description || externalDocs.url}</a> | ||
</LinkWrap> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters