Skip to content

Support DescriptionAttribute and ReadOnlyAttribute#3162

Merged
martincostello merged 3 commits intodomaindrivendev:masterfrom
jgarciadelanoceda:issue_1954_ComponentModelAttributes
Nov 22, 2024
Merged

Support DescriptionAttribute and ReadOnlyAttribute#3162
martincostello merged 3 commits intodomaindrivendev:masterfrom
jgarciadelanoceda:issue_1954_ComponentModelAttributes

Conversation

@jgarciadelanoceda
Copy link
Copy Markdown
Contributor

@jgarciadelanoceda jgarciadelanoceda commented Nov 20, 2024

contributes #1954
I do not really know what is intended with DisplayName attribute, but I am sure someone can give me advice in what to do with that attribute

@martincostello
Copy link
Copy Markdown
Collaborator

I do not really know what is intended with DisplayName attribute

IIRC, it's typically used to provide non-code text for UI elements for code members. For example:

[DisplayName("First name")]
public string FirstName { get; set; }

I've seen them commonly used to for the Visual Studio designer.

For example, this code renders how property windows like the one below Visual Studio.

image

Comment thread src/Swashbuckle.AspNetCore.SwaggerGen/SchemaGenerator/OpenApiSchemaExtensions.cs Outdated
@jgarciadelanoceda
Copy link
Copy Markdown
Contributor Author

IIRC, it's typically used to provide non-code text for UI elements for code members. For example:

I do not see the need for integrating this attribute, because there is already integrated by the serializers the JsonPropertyName and for Query/Path variables you can put the name of the parameter overriding the name of the object like what we do here:

public IEnumerable<Product> Get([FromQuery(Name = "kw")]string keywords = "foobar")

Javier García de la Noceda Argüelles added 2 commits November 22, 2024 04:29
@martincostello martincostello added this to the v7.0.1 milestone Nov 22, 2024
@martincostello martincostello merged commit bb49884 into domaindrivendev:master Nov 22, 2024
@jgarciadelanoceda jgarciadelanoceda deleted the issue_1954_ComponentModelAttributes branch November 22, 2024 15:05
This was referenced Jul 31, 2025
This was referenced Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants