-
Notifications
You must be signed in to change notification settings - Fork 271
Align the property types and refine the caches for properties #7340
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
Open
ArcturusZhang
wants to merge
11
commits into
microsoft:main
Choose a base branch
from
ArcturusZhang:align-tcgc-property-types
base: main
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
11 commits
Select commit
Hold shift + click to select a range
36c929b
update
ArcturusZhang 850d63f
a few updates
ArcturusZhang 141f152
wip
ArcturusZhang b2c230c
wip
ArcturusZhang 03f3082
API changed now we need to fix all the usage to comply
ArcturusZhang ad116a4
fix C# side issues
ArcturusZhang 3f8fc1d
fix test cases
ArcturusZhang 32b741f
Merge branch 'main' into align-tcgc-property-types
ArcturusZhang 0e3ce10
Merge remote-tracking branch 'origin/main' into align-tcgc-property-t…
ArcturusZhang f0820c1
regen
ArcturusZhang c464df5
Merge remote-tracking branch 'origin/main' into align-tcgc-property-t…
ArcturusZhang 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,9 @@ | |
|
||
import { | ||
AccessFlags, | ||
CollectionFormat, | ||
DecoratorInfo, | ||
SdkBuiltInKinds, | ||
SdkModelPropertyType, | ||
SerializationOptions, | ||
UsageFlags, | ||
} from "@azure-tools/typespec-client-generator-core"; | ||
|
@@ -121,7 +121,7 @@ export function isInputUnionType(type: InputType): type is InputUnionType { | |
*/ | ||
export interface InputModelType extends InputTypeBase { | ||
kind: "model"; | ||
properties: InputModelProperty[]; | ||
properties: InputProperty[]; | ||
name: string; | ||
crossLanguageDefinitionId: string; | ||
access?: AccessFlags; | ||
|
@@ -130,26 +130,72 @@ export interface InputModelType extends InputTypeBase { | |
additionalProperties?: InputType; | ||
discriminatorValue?: string; | ||
discriminatedSubtypes?: Record<string, InputModelType>; | ||
discriminatorProperty?: InputModelProperty; | ||
discriminatorProperty?: InputProperty; | ||
baseModel?: InputModelType; | ||
serializationOptions: SerializationOptions; | ||
} | ||
|
||
export interface InputModelProperty extends InputTypeBase { | ||
kind: SdkModelPropertyType["kind"]; | ||
name: string; | ||
serializedName: string; | ||
export interface InputModelPropertyTypeBase extends DecoratedType { | ||
type: InputType; | ||
name: string; | ||
doc?: string; | ||
summary?: string; | ||
// apiVersions: string[]; | ||
// onClient: boolean; | ||
// clientDefaultValue?: unknown; | ||
// isApiVersionParam: boolean; | ||
optional: boolean; | ||
crossLanguageDefinitionId: string; | ||
readOnly: boolean; | ||
access?: AccessFlags; | ||
} | ||
|
||
export interface InputModelProperty extends InputModelPropertyTypeBase { | ||
kind: "property"; | ||
discriminator: boolean; | ||
crossLanguageDefinitionId: string; | ||
serializedName: string; | ||
serializationOptions: SerializationOptions; | ||
flatten: boolean; | ||
serializationOptions?: SerializationOptions; | ||
} | ||
|
||
export function isInputModelType(type: InputType): type is InputModelType { | ||
return type.kind === "model"; | ||
export type InputProperty = InputModelProperty | InputHttpParameter; | ||
|
||
export type InputHttpParameter = | ||
| InputQueryParameter | ||
| InputPathParameter | ||
| InputHeaderParameter | ||
| InputBodyParameter; | ||
|
||
export interface InputQueryParameter extends InputModelPropertyTypeBase { | ||
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. Why does this type extend from InputModelProperty? It won't always be on a model, will it? |
||
kind: "query"; | ||
collectionFormat?: CollectionFormat; | ||
serializedName: string; | ||
correspondingMethodParams: InputProperty[]; | ||
explode: boolean; | ||
} | ||
|
||
export interface InputPathParameter extends InputModelPropertyTypeBase { | ||
kind: "path"; | ||
explode: boolean; | ||
style: "simple" | "label" | "matrix" | "fragment" | "path"; | ||
allowReserved: boolean; | ||
serializedName: string; | ||
correspondingMethodParams: InputProperty[]; | ||
} | ||
|
||
export interface InputHeaderParameter extends InputModelPropertyTypeBase { | ||
kind: "header"; | ||
collectionFormat?: CollectionFormat; | ||
serializedName: string; | ||
correspondingMethodParams: InputProperty[]; | ||
} | ||
|
||
export interface InputBodyParameter extends InputModelPropertyTypeBase { | ||
kind: "body"; | ||
serializedName: string; | ||
contentTypes: string[]; | ||
defaultContentType: string; | ||
correspondingMethodParams: InputProperty[]; | ||
} | ||
|
||
export interface InputEnumType extends InputTypeBase { | ||
|
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.
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.
nit: remove commented code