This repository was archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Fix/ven 54 fix documentation values #53
Open
Neozaru
wants to merge
10
commits into
master
Choose a base branch
from
fix/VEN-54-fixDocumentationValues
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2be1885
fix: VEN-54 nonce/signature/symbols and timestamps
Neozaru a7adcef
doc: VEN-54 add new endpoints and manage examples
Neozaru 48b19b9
doc: VEN-54 remove commented code + full lodash
Neozaru 664e1c6
doc: VEN-54 hide internal/deprecated + sort resp
Neozaru cd3f36d
doc: VEN-54 add missing examples + fix some endpts
Neozaru 7ae5b4f
feat: VEN-54 dynamic doc fetching + various fixes
Neozaru 96a7cc7
feat: VEN-54 remove console and some overlay.json
Neozaru adf20ca
Merge branch 'master' into fix/VEN-54-fixDocumentationValues
Neozaru e8fa82f
Merge branch 'master' into fix/VEN-54-fixDocumentationValues
mbrjo 34d0ea0
[VEN-54] Exclude from website documentation excluded categories. Fix …
mbrjo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
|
|
||
|
|
||
| // Extracts headers to be added in examples and code snippets | ||
| // In this case, we want to add authorization headers so example queries | ||
|
|
||
| import { getParamExample } from './getParamExample' | ||
|
|
||
| export function getExtraHeaders(headerParams = []) { | ||
| const extraHeaders = {} | ||
| headerParams.forEach(header => { | ||
| ['authorization'].includes(header.name) | ||
| extraHeaders[header.name] = getParamExample(header) | ||
| }) | ||
| return extraHeaders | ||
| } |
This file contains hidden or 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,9 @@ | ||
| import { getExtraHeaders } from './getExtraHeaders'; | ||
|
|
||
| export function getHeadersWithExtras(extraHeaderParams) { | ||
| return { | ||
| 'Accept': 'application/json', | ||
| 'Content-Type': 'application/json', | ||
| ...getExtraHeaders(extraHeaderParams) | ||
| } | ||
| } |
This file contains hidden or 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,15 @@ | ||
|
|
||
| export function getParamExample(params = {}) { | ||
| if (params.hasOwnProperty('example')) { | ||
| return params['example'] | ||
| } | ||
| if (params.hasOwnProperty('x-example')) { | ||
| return params['x-example'] | ||
| } | ||
| if (params.hasOwnProperty('default')) { | ||
| return params.default | ||
| } | ||
| if (params.enum && params.enum.length > 0) { | ||
| return params.enum[0] | ||
| } | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,16 +1,40 @@ | ||
| import {forEachEndpoint} from './forEachEndpoint'; | ||
|
|
||
| export function getSidebar(spec) { | ||
|
|
||
| var categoriesOrder = [ | ||
| 'platform', | ||
| 'wallet', | ||
| 'trading', | ||
| 'amm', | ||
| 'market', | ||
| 'governance', | ||
| 'dlm', | ||
| 'account', | ||
| 'public', | ||
| 'integration' | ||
| ]; | ||
|
|
||
| const getCategoryWeight = (category) => { | ||
| return categoriesOrder.length - categoriesOrder.indexOf(category.name.toLowerCase()) | ||
| }; | ||
|
|
||
| export function getSidebar(spec, categoriesToExclude) { | ||
| const categories = new Map(); | ||
| forEachEndpoint(spec, (entry) => { | ||
| forEachEndpoint(spec, (entry, orgPath, method) => { | ||
| if(!entry.tags) return; | ||
| const categoryName = entry.tags && entry.tags[0]; | ||
| const category = categories.get(categoryName) || {name: categoryName, items: []}; | ||
| category.items.push({ | ||
| title: entry.title, | ||
| title: | ||
| entry.title || // From swagger overlay JSON when entered manually | ||
| entry.description || // From 'notes' field of dvf-pub-api route options if exists | ||
| `${method.toUpperCase()} ${orgPath}`, // GET/POST <url> by default | ||
| name: entry.operationId, | ||
| link: '#' + entry.operationId, | ||
| }); | ||
| categories.set(categoryName, category); | ||
| }); | ||
| return [...categories.values()]; | ||
| return [...categories.values()] | ||
| .filter(category => !categoriesToExclude.includes(category.name.toLowerCase())) | ||
| .sort((categoryA, categoryB) => getCategoryWeight(categoryB) - getCategoryWeight(categoryA)) | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well include the entire
lodashThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was doing this before noticing that we've done this type of fine grained dep injection so I figured out there might be a reason although I am not sure. Do you think the weight different will be negligible if we import everything ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, especially in our usecase a few more KBs of lodash won't really have a major effect