-
Notifications
You must be signed in to change notification settings - Fork 40
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
Adding @promotion decorator and learnMoreDocs validation #287
Conversation
…spec-azure into yejeelee/promotions
…spec-azure into yejeelee/promotions
export interface PromotionOptions { | ||
apiVersion: string | EnumMember; | ||
autoUpdate?: boolean; | ||
} |
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.
export interface PromotionOptions { | |
apiVersion: string | EnumMember; | |
autoUpdate?: boolean; | |
} | |
export interface PromotionOptions { | |
readonly apiVersion: string | EnumMember; | |
readonly autoUpdate?: boolean; | |
} |
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.
good practice so that other libraries don't modify your state
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.
fixed :) thank you
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
…spec-azure into yejeelee/promotions
@@ -63,3 +70,9 @@ model AboutOptions { | |||
/** Set of links which can help learn more about the resource */ | |||
learnMoreDocs?: string[]; | |||
} | |||
|
|||
/** Options for promotion of ARM resource. */ | |||
model PromotionOptions { |
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.
Since it is a single data entry, it should be singular name.
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.
I kind of like it as it is, my thinking: it has several options inside... Promotion is singular, but it is done - could be multiple options. Does this make sense?
* The apiVersion will be used as a version to deploy to Portal. | ||
* @param options Property options provides promotion information of the resourceType. | ||
*/ | ||
extern dec promotion(target: Model, options: PromotionOptions); |
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.
Do you plan to always take a single version or an array?
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.
only single version always :)
@@ -17,3 +19,8 @@ export interface BrowseOptions { | |||
export interface marketplaceOfferOptions { | |||
id?: string; | |||
} | |||
|
|||
export interface PromotionOptions { |
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.
Same comments as above. Singular name
@@ -52,6 +55,72 @@ export function $browse(context: DecoratorContext, target: Model, options: Model | |||
} | |||
} | |||
|
|||
export function $promotion(context: DecoratorContext, target: Model, options: Model) { | |||
const { program } = context; | |||
validateDecoratorUniqueOnNode(context, target, $promotion); |
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.
nit: Since we are retiring @service{version}
and will only rely on @versioned
, it only rely on enum versions, the validation of each value provided can be greatly simplified. Only need to validate the enum specified is same as the one specified in @versioned
on the namespace. Compiler will ensure the values are correct.
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.
talked to Allen offline, it is okay to keep this logic since customers are still using the service logic!
adding a decorator called @promotion which helps us know which apiVersion for RP should be deploy to Portal.
also adding validation rule for @about.learnMoreDocs checking if the links are starting with https://