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(spec): add customRequest methods #178

Merged
merged 13 commits into from
Mar 1, 2022
Merged

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented Feb 25, 2022

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/APIC-339

Changes included:

Real changes are in scripts/buildSpecs.ts and common specs, all of the other are automatically generated.

  • Introduce script function propagateTagsToOperations that runs before buildSpec, which allows us to:
    • Provide a single customRequest definition that will be used for each clients
    • Remove tags definition from each paths file, this option can now be globally defined in the main <clientName>/spec.yml file.
    • Rename path template parameter to requestPath, to avoid conflict with parameters of the same name.
  • Fix batch and multipleBatch parameters

🧪 Test

CI :D

The CI might not pass before #179 is merged if cache is invalidated

@shortcuts shortcuts changed the title feat(specs): add customRequest methods feat(spec): add customRequest methods Feb 25, 2022
Base automatically changed from feat/typescript-script to main February 25, 2022 14:24
@shortcuts shortcuts requested review from a team, damcou and millotp and removed request for a team February 28, 2022 12:16
@shortcuts shortcuts marked this pull request as ready for review February 28, 2022 12:16
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.

I love it !

*/
private Call getCustomRequestCall(
String path,
Object body,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to specify queryParams ? Maybe with an helper

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean having a clearer name?

Copy link
Collaborator

Choose a reason for hiding this comment

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

body is just body right ? The list of queryParams will always be empty in this function (it can be passed inside the path but it defeats the purpose of having an api client)

Copy link
Member Author

@shortcuts shortcuts Mar 1, 2022

Choose a reason for hiding this comment

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

Ohhhh you commented on the get request I did not get it sorry, I'll try to make it query params!

Copy link
Member Author

Choose a reason for hiding this comment

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

wdyt? 88f0963

scripts/buildSpecs.ts Outdated Show resolved Hide resolved
scripts/buildSpecs.ts Show resolved Hide resolved
damcou
damcou previously approved these changes Feb 28, 2022
Copy link
Contributor

@damcou damcou left a comment

Choose a reason for hiding this comment

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

🚀

specs/common/paths/customRequest.yml Show resolved Hide resolved
@shortcuts shortcuts self-assigned this Mar 1, 2022
bodinsamuel
bodinsamuel previously approved these changes Mar 1, 2022

import { exists, run, toAbsolutePath } from './common';
import { createSpinner } from './oraLog';
import type { Spec } from './pre-gen/setHostsOptions';

async function propagateTagsToOperations(
Copy link
Contributor

Choose a reason for hiding this comment

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

This could have been a separate PR

specs/bundled/abtesting.yml Outdated Show resolved Hide resolved
description: This method allow you to send requests to the Algolia REST API.
parameters:
- $ref: '#/PathInPath'
- name: parameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you also add this to the others method ? I don't know if queryParams are restricted to GET in our api

Copy link
Member Author

@shortcuts shortcuts Mar 1, 2022

Choose a reason for hiding this comment

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

I thought I already did 🤔 You are right, this should do it: d4cd002

@shortcuts shortcuts requested a review from millotp March 1, 2022 16:40
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.

Nice

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