Commit 437cd32
fix: Apply field_names mapping to OpenAPI filter schema (#444)
The field_names DSL was respected at runtime for filter parsing (via
filter_ref_transformer) but the generated OpenAPI spec still advertised
filter properties and component schema ids under the raw internal field
name. A resource with field_names(title: :subject) accepted
filter[subject]=... at runtime but the spec advertised filter[title]=...
Route the filter property keys (attribute/calculation/aggregate) and the
"-filter-<name>" component schema id through
AshJsonApi.Resource.Info.field_to_json_key/2 so the spec matches runtime
behavior. Relationship keys and boolean combinators are unaffected as they
are not subject to field_names mapping.
This also changes the filter property key type from atom to string,
consistent with how the rest of the spec represents JSON:API keys.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 231baff commit 437cd32
3 files changed
Lines changed: 48 additions & 18 deletions
File tree
- lib/ash_json_api/json_schema
- test/acceptance
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3039 | 3039 | | |
3040 | 3040 | | |
3041 | 3041 | | |
3042 | | - | |
| 3042 | + | |
| 3043 | + | |
3043 | 3044 | | |
3044 | 3045 | | |
3045 | 3046 | | |
| |||
3093 | 3094 | | |
3094 | 3095 | | |
3095 | 3096 | | |
3096 | | - | |
| 3097 | + | |
3097 | 3098 | | |
3098 | 3099 | | |
3099 | 3100 | | |
| |||
3109 | 3110 | | |
3110 | 3111 | | |
3111 | 3112 | | |
3112 | | - | |
| 3113 | + | |
3113 | 3114 | | |
3114 | 3115 | | |
3115 | 3116 | | |
| |||
3123 | 3124 | | |
3124 | 3125 | | |
3125 | 3126 | | |
3126 | | - | |
| 3127 | + | |
3127 | 3128 | | |
3128 | 3129 | | |
3129 | 3130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
737 | 737 | | |
738 | 738 | | |
739 | 739 | | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
740 | 769 | | |
741 | 770 | | |
742 | 771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
470 | | - | |
| 470 | + | |
471 | 471 | | |
472 | | - | |
473 | | - | |
| 472 | + | |
| 473 | + | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
698 | | - | |
| 697 | + | |
| 698 | + | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
| 701 | + | |
702 | 702 | | |
703 | 703 | | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
715 | | - | |
| 715 | + | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
| 722 | + | |
723 | 723 | | |
724 | 724 | | |
725 | | - | |
| 725 | + | |
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
| |||
0 commit comments