Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(specs): improve API reference documentation #2831

Merged
merged 23 commits into from
Mar 12, 2024

Conversation

kai687
Copy link
Contributor

@kai687 kai687 commented Mar 5, 2024

🧭 What and Why

To make the OpenAPI-generated docs ready to replace the main API reference docs,
add more information from the API methods and API parameters docs.

🎟 JIRA Ticket:

Changes included:

  • Update the Search API's description. Especially parameters from the OLD API parameter reference.
  • Update redocly config for some better sorting (required before optional parameters, alphabetical sorting)
  • Fix: Search dictionaries endpoint has searchDictionaryEntries response
  • Fix: attributesForFaceting can only be used as index setting, not as search parameter.
  • Fix: the explain API parameter is not supposed to be exposed.

Make the API reference a little nicer with things like sorting
parameters and enums alphabetically.
@algolia-bot
Copy link
Collaborator

algolia-bot commented Mar 5, 2024

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

Copy link

github-actions bot commented Mar 5, 2024

@github-actions github-actions bot temporarily deployed to pull request March 5, 2024 16:41 Inactive
@kai687 kai687 marked this pull request as ready for review March 7, 2024 17:53
@kai687 kai687 requested a review from a team as a code owner March 7, 2024 17:53
@kai687 kai687 requested review from damcou and shortcuts March 7, 2024 17:53
@kai687
Copy link
Contributor Author

kai687 commented Mar 7, 2024

There's a type error with Go because of the update for the "Search dictionary" response. No idea how to fix this.

Error: algolia/search/model_search_dictionary_entries_response.go:93:11: cannot use v (variable of type *[]DictionaryEntry) as []DictionaryEntry value in assignment (typecheck)

@github-actions github-actions bot temporarily deployed to pull request March 10, 2024 10:56 Inactive
millotp
millotp previously approved these changes Mar 10, 2024
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

thanks for the hard work, this is huge !

@github-actions github-actions bot temporarily deployed to pull request March 11, 2024 08:13 Inactive
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

We might want additionalProperties: true if explain is not exposed because IIRC Kotlin throw on unknown props, @aallam ?

@shortcuts
Copy link
Member

This is a massiveeeee improvement thanks a lot @kai687

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

HUGE


ForwardToReplicas:
in: query
name: forwardToReplicas
description: Indicates whether changed index settings are forwarded to the replica indices.
description: Whether changes are applied to replica indices.
schema:
type: boolean

Page:
in: query
name: page
description: >
Copy link
Member

Choose a reason for hiding this comment

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

I think we can replace all > with pipes to preserve formatting, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done it for the Search API and common. Will do it for the rest in separate PRs when updating the docs for the other APIs.

Curiously, the | doesn't appear in the bundled specs. Something in the process of formatting and writing the spec changes this. I couldn't find any formatting artifacts on the website due to this, so I'm not sure what's going on here.

description: For compound entries, governs the behavior of the `word` parameter.
example: ['kopf','schmerz','tablette']
description: Invividual components of a compound word in the `compounds` dictionary.
example: [kopf, schmerz, tablette]
Copy link
Member

Choose a reason for hiding this comment

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

We should keep quotes since it's an array of string, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that what YAML requires? I thought quotes are only needed if you have special characters like - or : in the string. I thought that plain words don't require quotes. But since they also don't hurt, we might also leave them in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's ok to not quote it. Couldn't find anything that breaks because of this. The response example renders correctly as strings.

@kai687
Copy link
Contributor Author

kai687 commented Mar 11, 2024

Here's my reference for the explain parameter: https://algolia.atlassian.net/wiki/spaces/API/pages/4371874515/explain

@github-actions github-actions bot temporarily deployed to pull request March 11, 2024 16:07 Inactive
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

thanks !

@shortcuts shortcuts enabled auto-merge (squash) March 12, 2024 12:37
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

love it!

@shortcuts shortcuts disabled auto-merge March 12, 2024 12:37
@shortcuts shortcuts changed the title docs: improve API reference documentation feat(specs): improve API reference documentation Mar 12, 2024
@shortcuts shortcuts enabled auto-merge (squash) March 12, 2024 12:38
@github-actions github-actions bot temporarily deployed to pull request March 12, 2024 12:49 Inactive
@shortcuts shortcuts merged commit 156fd9e into main Mar 12, 2024
25 checks passed
@shortcuts shortcuts deleted the docs/reference-overhaul branch March 12, 2024 12:50
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.

4 participants