Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: spec refresh #801

Merged
merged 2 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sdk-codegen-scripts/scripts/refresh_specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@

import { updateSpecs } from './utils'
;(async () => {
console.warn('Did you `yarn wipe` in the root to clear the old spec files?')
console.warn('Did you remove the specs in the /specs folder?')
await updateSpecs()
})()
10 changes: 5 additions & 5 deletions packages/sdk-codegen-scripts/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const homeToRoost = '../../../'
const getRootPath = () => path.join(__dirname, homeToRoost)
const rootFile = (fileName = '') => path.join(getRootPath(), fileName)

export const apixSpecFileName = (fileName: string) => {
const p = path.parse(fileName)
return rootFile(`spec/${p.base}`)
}
// export const apixSpecFileName = (fileName: string) => {
// const p = path.parse(fileName)
// return rootFile(`spec/${p.base}`)
// }
jkaster marked this conversation as resolved.
Show resolved Hide resolved

// const copySpec = (fileName: string) => {
// const dest = apixSpecFileName(fileName)
Expand All @@ -63,7 +63,7 @@ export const updateSpecs = async (apiVersions = supportedApiVersions) => {
} in ${iniFile} ...`
)
const lookerVersions = await fetchLookerVersions(props)
const specs = getSpecsFromVersions(lookerVersions)
const specs = await getSpecsFromVersions(lookerVersions)
for (const v of apiVersions) {
try {
const specFile = await logConvertSpec(name, specs[v], lookerVersions)
Expand Down
5 changes: 5 additions & 0 deletions packages/sdk-codegen-scripts/src/convert.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ describe('spec conversion', () => {
const left = ApiModel.fromString(apiSource)
const right = ApiModel.fromString(spec)
const diff = compareSpecs(left, right)
// const deletes = Object.entries(left.methods)
// .filter(([_, m]) => m.httpMethod === 'DELETE')
// .map(([_, m]) => m.endpoint)
// const result = JSON.stringify(deletes, null, 2)
// console.log(result)
jkaster marked this conversation as resolved.
Show resolved Hide resolved
expect(diff).toHaveLength(0)
})

Expand Down
2 changes: 2 additions & 0 deletions packages/sdk-codegen/src/specConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export interface IApiVersion {
* API server base url (read-only)
*/
api_server_url?: string
/** Web server url */
web_server_url?: string
}

/** This declaration is duplicated DIRECTLY from @looker/sdk to detach dependency */
Expand Down