Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Node API Documentation Server #3925

Merged
merged 13 commits into from
Dec 5, 2018
Merged

Node API Documentation Server #3925

merged 13 commits into from
Dec 5, 2018

Conversation

parsonsmatt
Copy link
Contributor

@parsonsmatt parsonsmatt commented Dec 4, 2018

Description

This PR implements the documentation swagger server for the Node API.

TODO:

  • Accept config from cli

Linked issue

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.
  • CHANGELOG entry has been added and is linked to the correct PR on GitHub.

Testing checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.

QA Steps

Screenshots (if available)

How to merge

Send the message bors r+ to merge this PR. For more information, see
docs/how-to/bors.md.

@parsonsmatt parsonsmatt requested a review from KtorZ December 4, 2018 01:59
Copy link
Contributor

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One blocker: serveImpl vs serveDocImpl, otherwise 👍

-> Maybe TlsParams
-> IO ()
forkDocServer prxy swVersion ip port' tlsParams =
serveImpl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*serveDocImpl

There's a slight difference between both: we don't check nor require x509 client certificates for the doc server. Otherwise, it will require having setup those certificates in your browser in order to navigate and browse the document. Very unpractical, especially since certificates change from an environment to another.

& at "address" ?~ (Inline $ mempty
& type_ .~ SwaggerString
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, don't we have schema for Coin and Address already 🤔 ?

<redoc spec-url="../SERVANT_SWAGGER_UI_SCHEMA"></redoc>
<script src="redoc.min.js"> </script>
</body>
</html>|]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: upstream PR has been accepted some weeks ago and the default template has been fixed. So, using
servant-swagger-ui-redoc-0.3.2.1.22.2 should make this obsolete; using redocSchemaUIServer would be enough 😄

<*> tlsParamsParser
<*> debugModeParser
<*> addressParser "node-doc-address" (localhost, 8084)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be defaulting to 8080 (api) and 8180 (doc) as this is the current default in our wallet backend:

    monitoringApiPortParser :: Parser Word16
    monitoringApiPortParser = CLI.webPortOption 8080 "Port for the monitoring API."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then there will be a clash for the case when the node and wallet are running on the same host

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that's okay, we won't expose the monitoring API from the node anymore!

documentationApi curSoftwareVersion prxy = toSwagger prxy
& info.title .~ "Cardano Node API"
& info.version .~ fromString (show curSoftwareVersion)
& host ?~ "127.0.0.1:8083"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Any ways to take that from the doc -- though quite anecdotal

@parsonsmatt
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Dec 4, 2018
3925: Node API Documentation Server r=parsonsmatt a=parsonsmatt

## Description

This PR implements the documentation swagger server for the Node API.

TODO:

- [x] Accept config from cli

## Linked issue



Co-authored-by: parsonsmatt <[email protected]>
Co-authored-by: Matt Parsons <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 4, 2018

Build failed

@parsonsmatt
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Dec 4, 2018
3925: Node API Documentation Server r=parsonsmatt a=parsonsmatt

## Description

This PR implements the documentation swagger server for the Node API.

TODO:

- [x] Accept config from cli

## Linked issue



Co-authored-by: parsonsmatt <[email protected]>
Co-authored-by: Matt Parsons <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 5, 2018

Build failed

@parsonsmatt
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Dec 5, 2018
3925: Node API Documentation Server r=parsonsmatt a=parsonsmatt

## Description

This PR implements the documentation swagger server for the Node API.

TODO:

- [x] Accept config from cli

## Linked issue



Co-authored-by: parsonsmatt <[email protected]>
Co-authored-by: Matt Parsons <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 5, 2018

@iohk-bors iohk-bors bot merged commit 31e1e91 into develop Dec 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants