It is not a bug.
Problem
The problem is the following.
When you declare a type in OpenAPI like this:
data: {
field {
iv: string
}
}
}
You get a lot of types. I just use typescript as an example here:
type DataType = { field: FieldType };
type FieldType = { iv: string };
So for iv properties this kind of works. But when for localized fields you have an issue.
- When you add a new language you have to run the code generator again.
- In general you just a have a lot of types.
Solution
Therefore the decision was made to keep the field dynamic and generate something like this.
type DataType = { field: Object<string, string> };
For typescript it makes almost no difference, because the syntax to access an value is just the same.
For C# and types language, usually a dictionary is created:
class DataType {
public Dictionary<string, string> Field { get; set; }
}
So you can access the field like this.
myContent.Data.Field["iv"];
It still sucks
I am not sure whether I would go the decision with iv
again. it is very complicated but now I have to live with it. To make it a little bit easier there is the X-Flatten header: https://docs.squidex.io/02-documentation/concepts/localization#how-to-use-the-api. So you define via header the language you need and all properties are flatten.
Basically this would generate types like this:
type DataType = { field: string; };
Unfortunanetaly it is not possible to communicate this in a nice way with OpenAPI.
Therefore a second documentation is created for the flat representation, e.g.