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 cURL snippets #3841

Merged
merged 10 commits into from
Oct 9, 2024
Merged

feat(specs): add cURL snippets #3841

merged 10 commits into from
Oct 9, 2024

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented Sep 27, 2024

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-3026

Changes included:

some customer requester cURL example in the API reference page https://www.algolia.com/doc/rest-api/search/, I assume it is to quickly try some stuff before setting up a real codebase

the openapi-generator is a bit overkill and doesn't properly handle oneOf cases, this simple solution seems to be enough

@shortcuts shortcuts self-assigned this Sep 27, 2024
@algolia-bot
Copy link
Collaborator

algolia-bot commented Sep 27, 2024

✔️ Code generated!

Name Link
🪓 Triggered by 0eadd371344ef6fc29f47fcd9cdfdf4145d1df15
🍃 Generated commit c0f90f39aefc9b223ae223ac5be955e49e666820
🌲 Generated branch generated/feat/specs-cURL-snippet
📊 Benchmark results

Benchmarks performed on the method using a mock server, the results might not reflect the real-world performance.

Language Req/s
javascript 1616
go 1602
php 1510
csharp 1356
java 1034
python 1005
ruby 857
swift 705

@shortcuts
Copy link
Member Author

@shortcuts shortcuts marked this pull request as ready for review October 7, 2024 16:10
@shortcuts shortcuts requested a review from a team as a code owner October 7, 2024 16:10
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.

looks great !

@@ -1,9 +1,11 @@
import fsp from 'fs/promises';

import oas2har from '@har-sdk/oas';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
import oas2har from '@har-sdk/oas';
import { oas2har } from '@har-sdk/oas';

since you only use 1 function

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought so too based on their doc but seems like it's incorrect

SyntaxError: The requested module '@har-sdk/oas' does not provide an export named 'oas2har'

specMethod['x-codeSamples'].push({
lang: 'cURL',
label: 'curl',
source: new HTTPSnippet(harRequest as HarRequest).convert('shell', 'curl', { indent: '\t' }),
Copy link
Collaborator

Choose a reason for hiding this comment

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

why isn't it outputed like source: > like the other snippets ? maybe you need to convert it to a string with .toString() and replace the new lines

Copy link
Member Author

Choose a reason for hiding this comment

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

good point it's EXACTLY what i'm looking at right now

Copy link
Member Author

Choose a reason for hiding this comment

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

a7aad85 seems enough

Copy link
Collaborator

Choose a reason for hiding this comment

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

much more readable !

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.

looks f great !

@shortcuts shortcuts merged commit 6c30320 into main Oct 9, 2024
29 checks passed
@shortcuts shortcuts deleted the feat/specs-cURL-snippet branch October 9, 2024 08:25
algolia-bot added a commit that referenced this pull request Oct 9, 2024
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
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.

3 participants