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): add support for widgets / banners in search for the csharp client #3870

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}

- name: Download all artifacts
Expand Down Expand Up @@ -571,12 +570,17 @@ jobs:
} >> "$GITHUB_OUTPUT"
rm -rf tests/output/**/benchmarkResult.json

- name: Extract branch name
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

- name: Push generated code
id: pushGeneratedCode
run: yarn workspace scripts pushGeneratedCode
env:
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}

- name: update generation comment
uses: marocchino/sticky-pull-request-comment@v2
Expand Down Expand Up @@ -663,8 +667,9 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
ref: ${{ needs.codegen.outputs.generatedCommit }}
token: ${{ secrets.ALGOLIA_BOT_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Setup
uses: ./.github/actions/setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public override bool Equals(object obj)
}

return
(FacetOrdering == input.FacetOrdering || (FacetOrdering != null && FacetOrdering.Equals(input.FacetOrdering))) &&
(Redirect == input.Redirect || (Redirect != null && Redirect.Equals(input.Redirect)));
(FacetOrdering == input.FacetOrdering || (FacetOrdering != null && FacetOrdering.Equals(input.FacetOrdering))) &&
(Redirect == input.Redirect || (Redirect != null && Redirect.Equals(input.Redirect)));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
"aroundradiusall",
"automaticfacetfilter",
"automaticfacetfilters",
"banner",
"bannerimage",
"bannerimageurl",
"bannerlink",
"banners",
"baseindexsettings",
"basesearchparams",
"basesearchparamswithoutquery",
Expand Down Expand Up @@ -109,7 +114,8 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
"timerange",
"typotolerance",
"typotoleranceenum",
"value"
"value",
"widgets"
);

// This is used for the CTS generation
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/codegen/pushGeneratedCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function pushGeneratedCode(): Promise<void> {

await configureGitHubAuthor();

const baseBranch = await run('git branch --show-current');
const baseBranch = process.env.BRANCH_NAME || (await run('git branch --show-current'));
const isMainBranch = baseBranch === MAIN_BRANCH;
const IS_RELEASE_COMMIT = (await run('git log -1 --format="%s"')).startsWith(commitStartPrepareRelease);
console.log(`Checking codegen status on '${baseBranch}'.`);
Expand Down
54 changes: 54 additions & 0 deletions specs/common/schemas/IndexSettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ renderingContent:
$ref: '#/facetOrdering'
redirect:
$ref: '#/redirectURL'
widgets:
$ref: '#/widgets'
x-categories:
- Advanced

Expand All @@ -1022,6 +1024,58 @@ facetOrdering:
values:
$ref: '#/values'

widgets:
description: widgets returned from any rules that are applied to the current search.
type: object
additionalProperties: false
properties:
banners:
$ref: '#/banners'

banners:
description: banners defined in the merchandising studio for the given search.
type: array
additionalProperties: false
properties:
banners:
$ref: '#/banner'

banner:
description: a search banner with image and url.
type: object
additionalProperties: false
properties:
image:
$ref: '#/bannerImage'
link:
$ref: '#/bannerLink'

bannerLink:
description: link for a banner defined in merchandising studio.
type: object
additionalProperties: false
properties:
url:
type: string

bannerImage:
description: image of a search banner.
type: object
additionalProperties: false
properties:
urls:
$ref: '#/bannerImageUrl'
title:
type: string

bannerImageUrl:
description: url for a search banner image.
type: array
additionalProperties: false
properties:
url:
type: string

facets:
description: Order of facet names.
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import type {
AroundRadiusAll,
AutomaticFacetFilter,
AutomaticFacetFilters,
Banner,
BannerImage,
BannerImageUrl,
BannerLink,
Banners,
BaseIndexSettings,
BaseSearchParams,
BaseSearchParamsWithoutQuery,
Expand Down Expand Up @@ -79,6 +84,7 @@ import type {
TypoTolerance,
TypoToleranceEnum,
Value,
Widgets,
} from '@algolia/client-search';
import { apiClientVersion } from '@algolia/client-search';
import type { RecommendClient } from '@algolia/recommend';
Expand All @@ -103,6 +109,11 @@ export {
AroundRadiusAll,
AutomaticFacetFilter,
AutomaticFacetFilters,
Banner,
BannerImage,
BannerImageUrl,
BannerLink,
Banners,
BaseIndexSettings,
BaseSearchParams,
BaseSearchParamsWithoutQuery,
Expand Down Expand Up @@ -170,6 +181,7 @@ export {
TypoTolerance,
TypoToleranceEnum,
Value,
Widgets,
};

/**
Expand Down
Loading