No Way to Set "isRequired" to True in Filter Params
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
Research direction
Start with hydraSchemaAnalyzer.getFiltersParametersFromSchema and trace how FilterGuesser consumes isRequired and determines alwaysOn. Reproduce the reported SearchFilter and ApiProperty configurations, then verify that a supported configuration produces the expected required value in the introspected Filter Params.
Written by the indexing model from the issue text.
Description
API Platform version(s) affected: 4.0.3
Description
If you introspect the API Platform data and look at the Filter Params, there is a property "isRequired". It is always false no matter what I do with the API Platform configuration.
The FilterGuesser seems to want to evaluate that property to determine whether a filter should be "alwaysOn"... but I can't find any way tot set it.
How to reproduce
Create a Doctrine Entity with a SearchFilter configured.
In RA, introspect the API with something like this:
export function ETLogIntrospectedApiData() {
const dataProvider = useDataProvider();
const resourceName = useResourceContext();
const schemaAnalyzer = hydraSchemaAnalyzer();
dataProvider.introspect().then(({ data }: { data: Api }) => {
console.log("API Data:", data);
if (data && data.resources) {
const resource = data.resources.find((res) => res.name === resourceName);
if (resource) {
schemaAnalyzer
.getFiltersParametersFromSchema(resource)
.then((params) => {
console.log("Filter Params:", params);
});
schemaAnalyzer.getOrderParametersFromSchema(resource).then((params) => {
console.log("Order Params:", params);
});
}
}
});
}
Notice in the console the Filter Params have an isRequired property set to false.
There are no docs about how to set it to true and various things I've tried with ApiProperty aren't working.
- Dominant language
- TypeScript
- Stars
- 516
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from api-platform/admin
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
api-platform/admin#616 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
api-platform/admin#660 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
api-platform/admin#659 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
api-platform/admin#631 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
api-platform/admin#626 · 1 comment · 1 reaction ·
All issues in api-platform/admin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
fil-donadoni/tolaria#4409 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
corsairdev/corsair#1764 ·