-
Notifications
You must be signed in to change notification settings - Fork 35
Fix: Isomorphic OAS SDK gaps (@W-18669767@) #197
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
Changes from all commits
39d2a0a
8cba0b4
1307373
3488afa
18af95c
31b5893
2add33f
ac541c4
dc93377
7ac7938
c14441c
648cbc4
6cfdce0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| # build files | ||
| /src/lib | ||
| src/react-app-env.d.ts | ||
| openapitools.json | ||
|
|
||
| # dependencies | ||
| /node_modules | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,8 @@ import { | |
| ShopperLogin, | ||
| ShopperLoginPathParameters, | ||
| ShopperLoginQueryParameters, | ||
| TokenResponse, | ||
| } from '../../lib/shopperLogin'; | ||
| } from '../../lib/shopperLogin/apis'; | ||
| import {TokenResponse} from '../../lib/shopperLogin/models'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We went over this in the meet earlier but could you restate why this change in particular is needed or how the original version resulted in a conflict in the rolled up typescript?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, when we imported directly from the top level index file, it would duplicate the namespace By importing from the apis/models directory directly, we circumvent this issue |
||
| import ResponseError from '../responseError'; | ||
| import TemplateURL from '../templateUrl'; | ||
| import { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,7 +122,7 @@ export type {{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camel | |
| * | ||
| * | ||
| */ | ||
| export class {{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camelcase}}{{/lambda.titlecase}}<ConfigParameters extends {{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camelcase}}{{/lambda.titlecase}}Parameters & Record<string, unknown>> { | ||
| export class {{#vendorExtensions}}{{#x-sdk-classname}}{{{ . }}}{{/x-sdk-classname}}{{^x-sdk-classname}}{{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camelcase}}{{/lambda.titlecase}}{{/x-sdk-classname}}{{/vendorExtensions}}{{^vendorExtensions}}{{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camelcase}}{{/lambda.titlecase}}{{/vendorExtensions}}<ConfigParameters extends {{#lambda.titlecase}}{{#lambda.camelcase}}{{appName}}{{/lambda.camelcase}}{{/lambda.titlecase}}Parameters & Record<string, unknown>> { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this; I've applied the template changes (with some slight tweaks) to the node SDK PR: SalesforceCommerceCloud/commerce-sdk#418 The tweaks were to account for the namespacing that we do in the node sdk. In the future I wonder if there is some way we can make this easier to read or some way to extract it so we only define the full vendorExtensions block once. Not a blocker for this PR though. |
||
| // baseUri is not required on ClientConfig, but we know that we provide one in the class constructor | ||
| public clientConfig: ClientConfig<ConfigParameters> & { baseUri: string }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,14 +25,12 @@ export enum {{classname}}{{enumName}} { | |
| {{/allowableValues}} | ||
| } | ||
| {{/stringEnums}}{{^stringEnums}} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The resulting type is functionally the same, we just remove the exported variable. Example: Before: export const BasketChannelTypeEnum = {
Storefront: 'storefront',
Callcenter: 'callcenter',
Marketplace: 'marketplace',
Dss: 'dss',
Store: 'store',
Pinterest: 'pinterest',
Twitter: 'twitter',
Facebookads: 'facebookads',
Subscriptions: 'subscriptions',
Onlinereservation: 'onlinereservation',
Customerservicecenter: 'customerservicecenter',
Instagramcommerce: 'instagramcommerce',
Tiktok: 'tiktok',
Snapchat: 'snapchat',
Google: 'google',
Whatsapp: 'whatsapp',
Youtube: 'youtube'
} as const;
// type BasketChannelTypeEnum = "storefront" | "callcenter" | "marketplace" | "dss" | "store" | "pinterest" | "twitter" | "facebookads" | "subscriptions" | "onlinereservation" | "customerservicecenter" | ... 5 more ... | "youtube"
export type BasketChannelTypeEnum = typeof BasketChannelTypeEnum[keyof typeof BasketChannelTypeEnum];After: export type BasketChannelTypeEnum =
'storefront'|
'callcenter'|
'marketplace'|
'dss'|
'store'|
'pinterest'|
'twitter'|
'facebookads'|
'subscriptions'|
'onlinereservation'|
'customerservicecenter'|
'instagramcommerce'|
'tiktok'|
'snapchat'|
'google'|
'whatsapp'|
'youtube'; |
||
| export const {{classname}}{{enumName}} = { | ||
| export type {{classname}}{{enumName}} = | ||
| {{#allowableValues}} | ||
| {{#enumVars}} | ||
| {{{name}}}: {{{value}}}{{^-last}},{{/-last}} | ||
| {{{value}}}{{^-last}}|{{/-last}}{{#-last}};{{/-last}} | ||
| {{/enumVars}} | ||
| {{/allowableValues}} | ||
| } as const; | ||
| export type {{classname}}{{enumName}} = typeof {{classname}}{{enumName}}[keyof typeof {{classname}}{{enumName}}]; | ||
| {{/stringEnums}} | ||
| {{/isEnum}} | ||
| {{/vars}} | ||
|
|
||
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.
heads up that I applied a fix to this test also as part of #198 .
In there, I replaced
expectedReqOptionswith a check that ensurescode_challengewasn't included.