abp icon indicating copy to clipboard operation
abp copied to clipboard

abp generate-proxy does not create the model properties as set by the [JsonProperty] attribue

Open idreeshaddad opened this issue 5 years ago • 6 comments

  • ABP Framework version 4.2.1 (Stable).
  • User Interface Angular.
  • Database Provider EF Core 5

I'm using vivet/GoogleApi. When abp generate-proxy generates a TypeScript model of a Dto that has a [JsonProperty] attribute; the output model has the name of the C# property instead of the name in the attribute.

For example, I'm returning: https://github.com/vivet/GoogleApi/blob/bed8a7988feba69bb9037afd597dc08b0a42195e/GoogleApi/Entities/Places/Details/Response/DetailsResult.cs#L23 image

And what I'm getting in the generated model is: image

But the serializer in the ApplicationService is serializing it into the name put in the attribute: image

Is there an option to overcome this problem, or am I missing something?

idreeshaddad avatar Feb 18 '21 18:02 idreeshaddad

Hi @idreeshaddad,

We will investigate the issue and reply you asap. Thanks.

cotur avatar Feb 20 '21 21:02 cotur

Resolved by #7819

Angular part has been moved to #7852

hikalkan avatar Feb 24 '21 16:02 hikalkan

Thank you guys for the effort, but unfortunately the problem still exists after updating to 4.3: image

As you can see, abp generate-proxy generated a TypeScript model of a Dto that has a [JsonProperty] attribute; the output model has the name of the C# property instead of the name in the attribute!

(JsonProperty) image

(Abp generated TypeScript model) image

idreeshaddad avatar May 01 '21 11:05 idreeshaddad

@idreeshaddad Can you try a new project?

maliming avatar May 02 '21 02:05 maliming

Hi @idreeshaddad,

There is a package called @abp/ng.schematics in the package.json file. Please upgrade it to v4.3.0 and try again.

armanozak avatar May 02 '21 06:05 armanozak

Hi @idreeshaddad,

There is a package called @abp/ng.schematics in the package.json file. Please upgrade it to v4.3.0 and try again.

Thank you @armanozak it worked. And for those who might stumble upon this issue: Do not forget to npm install after you change the schematics version, then abp generate-proxy , and enjoy programming.

idreeshaddad avatar May 06 '21 08:05 idreeshaddad