How can show calculate as fields object in Swaggerui
Hi sorry, i made my calculate public and i can see in the example of
Success Responses
but inside fields object
it just shows the attributes! and user has to change it by his hand and add the calculate name . if i change this manually in the fields object
text aria it works!
Is there a way to show calculate as fields inside this text aria as default?
or i should change the AshJsonApiRouter
?
Thank you in advance
7 Replies
you would probably have to customize
default_fields
for the resource https://hexdocs.pm/ash_json_api/dsl-ashjsonapi-resource.html#json_api-default_fields - this defaults to all public fields (not calculations or aggregates)If you mean this
still the
permission_values
which is calculation dose not exist in the fields object
Because the front developers read the api, it is very hard to tell them read the Responses example
so i need to put it as default inside fields object
oh interesting, yes that's what I meant
https://github.com/ash-project/ash_json_api/blob/v1.4.40/lib/ash_json_api/json_schema/open_api.ex#L1931-L1947 we might want to update both the
example
fields here to use the value from default_fields
insteadGitHub
ash_json_api/lib/ash_json_api/json_schema/open_api.ex at v1.4.40 ·...
The JSON:API extension for the Ash Framework. Contribute to ash-project/ash_json_api development by creating an account on GitHub.
Or consider calculation if dose not define default fields 🤔
The "default default fields" is all public attributes and that won't change
Solution
But it does look like that open api schema is wrong. Issue/PR welcome 🙂