Skip to content

docs: added REST documentation for fields query string parameter to filter response fields#83

Merged
github-actions[bot] merged 1 commit intomainfrom
docs/fields-query
Oct 15, 2025
Merged

docs: added REST documentation for fields query string parameter to filter response fields#83
github-actions[bot] merged 1 commit intomainfrom
docs/fields-query

Conversation

@IgnatG
Copy link
Contributor

@IgnatG IgnatG commented Oct 15, 2025

Closes #41

Summary

This PR add the relevant documentation for the fields query parameter in REST APIs, allowing consumers to specify which fields should be included in JSON responses.

Changes Made

API Guidelines Documentation

  • Added new "Field Selection" section in pagination-filtering-sorting.md
  • Usage examples including:
    • Basic field selection: GET /api/widgets?fields=id,name,createdAt
    • Combining with other parameters: GET /api/widgets?fields=id,name,status&status=active&limit=5
    • Default behaviour when the fields parameter is omitted
  • Detailed behaviour specifications:
    • Valid fields - include only the requested fields in the response
    • Invalid field names - ignore silently and include only valid ones
    • Empty fields parameter - return all fields (same as omitting parameter)
    • Case sensitivity - field names are case-sensitive
    • Nested fields - support dot notation for nested objects (e.g., metadata.total)

OpenAPI Example Updates

  • Added fieldsParam component in example.1.0.0.oas.yml
  • Regex validation pattern to ensure proper field name format
  • Multiple usage examples:
    • Basic fields: resultId,nhsNumber,result
    • Nested fields: resultId,nhsNumber,metadata.createdAt
    • Multiple fields: resultId,nhsNumber,type,result,metadata.createdAt,metadata.updatedAt
  • Integrated with existing /results endpoint alongside pagination, filtering, and sorting parameters

@IgnatG IgnatG requested a review from a team as a code owner October 15, 2025 14:13
@github-actions
Copy link

Test Results

36 tests   36 ✅  13s ⏱️
 4 suites   0 💤
 1 files     0 ❌

Results for commit e175b9c.

Copy link
Contributor

@andreyyudin andreyyudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@IgnatG IgnatG added the fast-forward triggers fast-forward merge workflow label Oct 15, 2025
@github-actions
Copy link

🎉 Success! 🎉

PR successfully Fast Forward merged in ✅.

@github-actions github-actions bot merged commit e175b9c into main Oct 15, 2025
20 checks passed
@github-actions github-actions bot deleted the docs/fields-query branch October 15, 2025 14:52
@github-actions github-actions bot removed the fast-forward triggers fast-forward merge workflow label Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add REST documentation for fields query string parameter to filter response fields

3 participants