Commit 2de7930
Generate CodeGen customization attributes in fixed namespace (#9122)
- [x] Understand the issue: CodeGen customization attributes should be
generated in a fixed namespace to avoid API compatibility failures
- [x] Identify the suggested namespace from Azure SDK issue #54144:
`Microsoft.TypeSpec.Generator.Customizations`
- [x] Add `CustomizationAttributeNamespace` constant to
`CodeModelGenerator` class (changed to `internal` per review feedback)
- [x] Override `BuildNamespace()` in CodeGen attribute definition
classes to return the fixed namespace
- [x] Update test data files to use the new namespace
- [x] Update expected test strings in `ClientCustomizationTests`
- [x] Update custom code files in Sample-TypeSpec to import the new
namespace
- [x] Update generated attribute files in Sample-TypeSpec to use the new
namespace
- [x] Run tests to validate changes (all pass)
- [x] Request code review (passed with no comments)
- [x] Address review feedback: Changed `CustomizationAttributeNamespace`
from `public` to `internal`
## Security Summary
No security vulnerabilities were introduced. The changes only modify
namespace declarations and add using directives - no new code paths, no
external inputs, and no changes to security-sensitive logic.
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Generate CodeGen customization attributes in fixed
namespace</issue_title>
> <issue_description>See
Azure/azure-sdk-for-net#54144 for more
context.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
- Fixes #9121
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>1 parent ea81836 commit 2de7930
File tree
77 files changed
+94
-9
lines changed- packages/http-client-csharp/generator
- Microsoft.TypeSpec.Generator.ClientModel/test/Providers
- ClientProviders/TestData/ClientProviderCustomizationTests
- CanRemoveCachingField
- CanRenameSubClient
- Definitions/TestData/Classifier2xxAnd4xxDefinitionTests/TestGetTypeCustomNamespace
- EnumProvider/TestData/SerializationCustomizationTests/CanChangeEnumMemberName
- MrwSerializationTypeDefinitions/TestData
- DynamicModelSerializationTests
- PropagateCustomizedDynamicListPropertyMixed
- PropagateCustomizedDynamicListProperty
- PropagateCustomizedDynamicPropertyMixed
- PropagateCustomizedDynamicProperty
- WriteReadOnlySpanProperty
- ModelCustomizationTests
- CanChangePropertyName
- CanCustomizeEnumToFieldFrameworkType
- CanCustomizeModelName
- CanCustomizePropertyUsingField
- CanSerializeCustomPropertyFromBase
- SerializationCustomizationTests
- CanChangeListOfEnumPropToListOfExtensibleEnum
- CanChangePropertyNameAndRedefineOriginal
- CanChangePropertyName
- CanChangePropertySerializedName
- CanCustomizePropertyUsingField(False)
- CanCustomizePropertyUsingField(True)
- CanCustomizeSerializationMethodForPropertyInBase
- CanCustomizeSerializationMethodForRenamedProperty
- CanCustomizeSerializationMethod
- ReadOnlyMemPropertyType
- RestClientProviders/TestData/RestClientProviderCustomizationTests/CanChangeClientNamespace
- ScmModelProvider/TestData/ScmModelProviderTests
- TestCustomStructDynamicModel
- TestDynamicModelWithCustomFullConstructor
- TestData/ScmMethodProviderCollectionTests/CollectionResultDefinitionAddedEvenWhenPagingMethodsCustomized
- Microsoft.TypeSpec.Generator
- src
- Providers
- test
- Providers
- ModelFactories/TestData/ModelFactoriesCustomizationTests/CanCustomizeModelFullConstructor(True)
- ModelProviders
- TestData
- ClientCustomizationTests
- CanRemoveConstructorContainingGeneratedType
- CanRemoveConstructors
- CanRemoveMethods
- CustomCodeAttributesAreLoadedIntoAttributeStatements
- DoesNotRemoveConstructorsThatDoNotMatch
- DoesNotRemoveMethodsThatDoNotMatch
- DiscriminatorTests
- CanCustomizeDiscriminator
- ModelWithCustomExtensibleEnumDiscriminator
- ModelWithCustomFixedEnumDiscriminator
- ModelCustomizationTests
- CanChangeArrayOfEnumPropToArrayOfExtensibleEnum
- CanChangeDictOfEnumPropToDictOfExtensibleEnum
- CanChangeEnumMemberName
- CanChangeEnumName
- CanChangeListOfEnumPropToListOfExtensibleEnumField
- CanChangeListOfEnumPropToListOfExtensibleEnum
- CanChangeListOfExtensibleEnumToReadOnlyListOfExtensibleEnum
- CanChangeModelNameAndToStructAtSameTime
- CanChangeModelName
- CanChangePropertyNameAndRedefineOriginal
- CanChangePropertyName
- CanChangePropertyTypeToEnum
- CanChangePropertyType
- CanCustomizeDiscriminatorModel
- CanCustomizeModelNameWithCustomizedNamespace
- CanCustomizeTypeRenamedInVisitor
- CanCustomizeTypeWithChangedNamespaceInVisitor
- CanRemoveField
- CanRemoveProperty
- DoesNotIncludeReqCustomFieldLiteralInDefaultCtor
- DoesNotIncludeReqCustomLiteralInDefaultCtor
- TestData
- CanonicalTypeProviderTests/TestPropertyDocs
- TypeProviderTests
- CanCustomizeNestedTypesWithRenamedDeclaringType
- LastContractViewLoadedForRenamedVisitedType(False)
- TestSpecViewReturnsAllPropertiesEvenWhenSuppressed
- TestProjects/Local/Sample-TypeSpec/src
- Custom
- Generated/Internal
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
77 files changed
+94
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
0 commit comments