f-o-a-m / foam.developer

FOAM Developer portal
https://developer.foam.space
MIT License
13 stars 10 forks source link

V1.0 #28

Closed martyall closed 5 years ago

martyall commented 5 years ago

Update the docs for the 1.0 release of the API

TODO

sectore commented 5 years ago

Unfortunately https://github.com/f-o-a-m/foam.tcr/pull/862 could not fix swagger-ui issue.

Even updating foam-hexo-theme-doc to latest dependencies to have latest swagger-parser could not fix the issue.

The issue seems to be still a wrong ToSchema declaration of any type on Haskell side.

npm start
...
JSON_OBJECT_VALIDATION_FAILED
SyntaxError: Swagger schema validation failed. 
  Data does not match any schemas from 'anyOf' at #/tags/0/definitions/SearchTextPOI/type/example/geohash/address/properties/address/type/example/description/geohash/type/format/example/required/description/ClaimableVote/type/properties/salt/type/format/example/description/numTokens/type/format/example/description/choice/enum/type/format/description/challengeID/type/format/example/description/listingHash/type/format/example/description/listingName/type/required/description/LockedVote/type/properties/listingName/type/listingHash/type/format/example/description/numTokens/type/format/example/description/revealExpiration/type/format/example/commitExpiration/type/format/example/challengeID/type/format/example/description/address/type/format/example/description/required/description/VoteChoice/enum/type/format/description/RevealedVote/type/properties/numTokens/type/format/example/description/txHash/type/format/example/description/choice/enum/type/format/description/challengeID/type/format/example/description/listingHash/type/format/example/description/address/type/format/example/description/required/description/UserAssets/type/example/verifiedPOIs/challengedPOIs/pendingPOIs/properties/pendingPOIs/type/minimum/maximum/challengedPOIs/type/minimum/maximum/verifiedPOIs/type/minimum/maximum/required/description/TokenID/type/format/example/description/SignalSearchResult/type/example/nftAddress/geohash/owner/tokenId/stake/radius/createdAt/cst/properties/createdAt/type/format/example/radius/type/format/example/description/geohash/type/format/example/stake/type/format/example/description/owner/type/format/example/description/tokenId/type/format/example/description/nftAddress/type/format/example/description/cst/type/format/example/description/required/description/RemovedPOIState/type/properties/removedAt/type/format/example/createdAt/type/format/example/required/description/POIDoc/type/properties/data/type/example/tags/description/web/name/geohash/address/uUID/phone/properties/poiDataWeb/type/example/description/poiDataPhone/type/example/description/poiDataDescription/type/poiDataTags/type/items/type/example/description/poiDataAddress/type/example/description/poiDataGeohash/type/format/example/poiDataName/type/poiDataUUID/type/format/example/required/meta/type/properties/transactionHash/type/format/example/description/owner/type/format/example/description/eid/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/RemovedPOI/type/properties/state/type/properties/removedAt/type/format/example/createdAt/type/format/example/required/description/challenge/type/properties/data/type/example/reason/properties/cdReason/type/required/metaData/type/properties/owner/type/format/example/description/eid/type/format/example/description/pollID/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/doc/type/properties/data/type/example/tags/description/web/name/geohash/address/uUID/phone/properties/poiDataWeb/type/example/description/poiDataPhone/type/example/description/poiDataDescription/type/poiDataTags/type/items/type/example/description/poiDataAddress/type/example/description/poiDataGeohash/type/format/example/poiDataName/type/poiDataUUID/type/format/example/required/meta/type/properties/transactionHash/type/format/example/description/owner/type/format/example/description/eid/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/required/description/POISearchResult/type/example/tags/name/geohash/owner/listingHash/state/properties/tags/type/items/type/example/description/owner/type/format/example/description/listingHash/type/format/example/description/geohash/type/format/example/state/type/example/deposit/createdAt/status/properties/createdAt/type/format/example/deposit/type/format/example/description/status/type/minProperties/maxProperties/properties/applied/properties/endDate/type/format/example/type/required/challenged/properties/challenge/type/format/example/description/maturity/type/minProperties/maxProperties/example/properties/removed/type/items
    Expected type object but found type array at #/tags/0/definitions/SearchTextPOI/type/example/geohash/address/properties/address/type/example/description/geohash/type/format/example/required/description/ClaimableVote/type/properties/salt/type/format/example/description/numTokens/type/format/example/description/choice/enum/type/format/description/challengeID/type/format/example/description/listingHash/type/format/example/description/listingName/type/required/description/LockedVote/type/properties/listingName/type/listingHash/type/format/example/description/numTokens/type/format/example/description/revealExpiration/type/format/example/commitExpiration/type/format/example/challengeID/type/format/example/description/address/type/format/example/description/required/description/VoteChoice/enum/type/format/description/RevealedVote/type/properties/numTokens/type/format/example/description/txHash/type/format/example/description/choice/enum/type/format/description/challengeID/type/format/example/description/listingHash/type/format/example/description/address/type/format/example/description/required/description/UserAssets/type/example/verifiedPOIs/challengedPOIs/pendingPOIs/properties/pendingPOIs/type/minimum/maximum/challengedPOIs/type/minimum/maximum/verifiedPOIs/type/minimum/maximum/required/description/TokenID/type/format/example/description/SignalSearchResult/type/example/nftAddress/geohash/owner/tokenId/stake/radius/createdAt/cst/properties/createdAt/type/format/example/radius/type/format/example/description/geohash/type/format/example/stake/type/format/example/description/owner/type/format/example/description/tokenId/type/format/example/description/nftAddress/type/format/example/description/cst/type/format/example/description/required/description/RemovedPOIState/type/properties/removedAt/type/format/example/createdAt/type/format/example/required/description/POIDoc/type/properties/data/type/example/tags/description/web/name/geohash/address/uUID/phone/properties/poiDataWeb/type/example/description/poiDataPhone/type/example/description/poiDataDescription/type/poiDataTags/type/items/type/example/description/poiDataAddress/type/example/description/poiDataGeohash/type/format/example/poiDataName/type/poiDataUUID/type/format/example/required/meta/type/properties/transactionHash/type/format/example/description/owner/type/format/example/description/eid/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/RemovedPOI/type/properties/state/type/properties/removedAt/type/format/example/createdAt/type/format/example/required/description/challenge/type/properties/data/type/example/reason/properties/cdReason/type/required/metaData/type/properties/owner/type/format/example/description/eid/type/format/example/description/pollID/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/doc/type/properties/data/type/example/tags/description/web/name/geohash/address/uUID/phone/properties/poiDataWeb/type/example/description/poiDataPhone/type/example/description/poiDataDescription/type/poiDataTags/type/items/type/example/description/poiDataAddress/type/example/description/poiDataGeohash/type/format/example/poiDataName/type/poiDataUUID/type/format/example/required/meta/type/properties/transactionHash/type/format/example/description/owner/type/format/example/description/eid/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/required/description/POISearchResult/type/example/tags/name/geohash/owner/listingHash/state/properties/tags/type/items/type/example/description/owner/type/format/example/description/listingHash/type/format/example/description/geohash/type/format/example/state/type/example/deposit/createdAt/status/properties/createdAt/type/format/example/deposit/type/format/example/description/status/type/minProperties/maxProperties/properties/applied/properties/endDate/type/format/example/type/required/challenged/properties/challenge/type/format/example/description/maturity/type/minProperties/maxProperties/example/properties/removed/type/items
    Array is too short (0), minimum 1 at #/tags/0/definitions/SearchTextPOI/type/example/geohash/address/properties/address/type/example/description/geohash/type/format/example/required/description/ClaimableVote/type/properties/salt/type/format/example/description/numTokens/type/format/example/description/choice/enum/type/format/description/challengeID/type/format/example/description/listingHash/type/format/example/description/listingName/type/required/description/LockedVote/type/properties/listingName/type/listingHash/type/format/example/description/numTokens/type/format/example/description/revealExpiration/type/format/example/commitExpiration/type/format/example/challengeID/type/format/example/description/address/type/format/example/description/required/description/VoteChoice/enum/type/format/description/RevealedVote/type/properties/numTokens/type/format/example/description/txHash/type/format/example/description/choice/enum/type/format/description/challengeID/type/format/example/description/listingHash/type/format/example/description/address/type/format/example/description/required/description/UserAssets/type/example/verifiedPOIs/challengedPOIs/pendingPOIs/properties/pendingPOIs/type/minimum/maximum/challengedPOIs/type/minimum/maximum/verifiedPOIs/type/minimum/maximum/required/description/TokenID/type/format/example/description/SignalSearchResult/type/example/nftAddress/geohash/owner/tokenId/stake/radius/createdAt/cst/properties/createdAt/type/format/example/radius/type/format/example/description/geohash/type/format/example/stake/type/format/example/description/owner/type/format/example/description/tokenId/type/format/example/description/nftAddress/type/format/example/description/cst/type/format/example/description/required/description/RemovedPOIState/type/properties/removedAt/type/format/example/createdAt/type/format/example/required/description/POIDoc/type/properties/data/type/example/tags/description/web/name/geohash/address/uUID/phone/properties/poiDataWeb/type/example/description/poiDataPhone/type/example/description/poiDataDescription/type/poiDataTags/type/items/type/example/description/poiDataAddress/type/example/description/poiDataGeohash/type/format/example/poiDataName/type/poiDataUUID/type/format/example/required/meta/type/properties/transactionHash/type/format/example/description/owner/type/format/example/description/eid/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/RemovedPOI/type/properties/state/type/properties/removedAt/type/format/example/createdAt/type/format/example/required/description/challenge/type/properties/data/type/example/reason/properties/cdReason/type/required/metaData/type/properties/owner/type/format/example/description/eid/type/format/example/description/pollID/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/doc/type/properties/data/type/example/tags/description/web/name/geohash/address/uUID/phone/properties/poiDataWeb/type/example/description/poiDataPhone/type/example/description/poiDataDescription/type/poiDataTags/type/items/type/example/description/poiDataAddress/type/example/description/poiDataGeohash/type/format/example/poiDataName/type/poiDataUUID/type/format/example/required/meta/type/properties/transactionHash/type/format/example/description/owner/type/format/example/description/eid/type/format/example/description/listingHash/type/format/example/description/hash/type/type/type/required/description/required/description/required/description/POISearchResult/type/example/tags/name/geohash/owner/listingHash/state/properties/tags/type/items/type/example/description/owner/type/format/example/description/listingHash/type/format/example/description/geohash/type/format/example/state/type/example/deposit/createdAt/status/properties/createdAt/type/format/example/deposit/type/format/example/description/status/type/minProperties/maxProperties/properties/applied/properties/endDate/type/format/example/type/required/challenged/properties/challenge/type/format/example/description/maturity/type/minProperties/maxProperties/example/properties/removed/type/items

JSON_OBJECT_VALIDATION_FAILED
    at validateSchema (/home/jk/Wrk/foam/repos/foam-hexo-theme-doc/node_modules/swagger-parser/lib/validators/schema.js:27:15)
    at /home/jk/Wrk/foam/repos/foam-hexo-theme-doc/node_modules/swagger-parser/lib/index.js:152:9
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

z-schema validation error: JSON_OBJECT_VALIDATION_FAILED
    at ZSchema.getLastError (/home/jk/Wrk/foam/repos/foam-hexo-theme-doc/node_modules/z-schema/src/ZSchema.js:260:13)
    at validateSchema (/home/jk/Wrk/foam/repos/foam-hexo-theme-doc/node_modules/swagger-parser/lib/validators/schema.js:25:23)
    at /home/jk/Wrk/foam/repos/foam-hexo-theme-doc/node_modules/swagger-parser/lib/index.js:152:9
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
sectore commented 5 years ago

Ok, https://github.com/f-o-a-m/foam.tcr/pull/862 will fix it. I've just forgotten to run foam.developer by using latest changes of swagger.json locally, but not using https://map-api-direct.foam.space/swagger.json which has still issues of course. BTW: Here is a nice validator for swagger.json files https://apidevtools.org/swagger-parser/online/?url=https%3A%2F%2Fmap-api-direct.foam.space%2Fswagger.json

Quick preview: screenshot from 2019-01-23 14-28-28

sectore commented 5 years ago

Could you try to run https://github.com/f-o-a-m/foam-hexo-theme-doc/pull/1 and https://github.com/f-o-a-m/hexo-renderer-sass/pull/1 with this PR?

I have some font rendering issues locally by using latest npm packages, but also by using previous versions of foam-hexo-theme-doc or hexo-renderer-sass. And I just want to make sure that's an issue on my machine only.

Expected font: screenshot from 2019-01-23 19-20-05

What I have locally: screenshot from 2019-01-23 19-20-19

The style inspector shows me as font-family: 'Open Sans', but the rendering is very different.

The only needed part to run changes of foam-hexo-theme-doc and hexo-renderer-sass in this PR is to install some babel stuff before

npm i -S babel-core babel-preset-env babel-preset-react

and to point to PR branches of foam-hexo-theme-doc and hexo-renderer-sass.

Here is a diff of package.json I'm currently running locally (I've updated some other things, too)

diff --git a/package.json b/package.json
index bea7de2..f3cf386 100644
--- a/package.json
+++ b/package.json
@@ -9,20 +9,23 @@
     "start": "hexo clean && hexo s -p 4040"
   },
   "hexo": {
-    "version": "3.6.0"
+    "version": "3.8.0"
   },
   "devDependencies": {
     "hexo-cli": "^1.1.0"
   },
   "dependencies": {
-    "foam-hexo-theme-doc": "git+https://git@github.com/f-o-a-m/foam-hexo-theme-doc.git",
+    "babel-core": "^6.26.3",
+    "babel-preset-env": "^1.7.0",
+    "babel-preset-react": "^6.24.1",
+    "foam-hexo-theme-doc": "git+https://git@github.com/f-o-a-m/foam-hexo-theme-doc.git#fix/upgrade-deps",
     "hexo": "^3.6.0",
     "hexo-filter-mermaid-diagrams": "^1.0.5",
     "hexo-github-card": "^1.0.2",
     "hexo-renderer-ejs": "^0.3.1",
-    "hexo-renderer-less": "^0.2.0",
+    "hexo-renderer-less": "^1.0.0",
     "hexo-renderer-marked": "^0.3.2",
-    "hexo-renderer-sass": "git+https://git@github.com/f-o-a-m/hexo-renderer-sass.git",
+    "hexo-renderer-sass": "git+https://git@github.com/f-o-a-m/hexo-renderer-sass.git#fix/upgrade-deps",
     "hexo-server": "^0.3.1",
     "hexo-tag-owl": "^1.2.2"
   }