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

codegen: Update ureq to support v3.x #697

Open
Udhay-Adithya opened this issue Mar 23, 2025 · 6 comments · May be fixed by #788
Open

codegen: Update ureq to support v3.x #697

Udhay-Adithya opened this issue Mar 23, 2025 · 6 comments · May be fixed by #788

Comments

@Udhay-Adithya
Copy link
Contributor

Describe the bug/problem

The current ureq code generator produces code using response.into_string(), which is not compatible with ureq 3.x. This method was removed in the major rewrite, leading to compilation errors.

ureq 3.0.0-rc1 release notes
ureq 2.12.1 docs
ureq 3.0.0 docs

In the 2.12.1 docs the method into_string() is used but in the next version(3.0.0) the method into_string() is not used.

Steps to Reproduce the bug/problem

  1. Create a new rust project
  2. add ureq v3.x.x to dependencies
  3. Run the below code generated from API Dash
fn main() -> Result<(), ureq::Error> {
    let url = "https://jsonplaceholder.typicode.com/posts";
    let response = ureq::get(url).call()?;

    println!("Response Status: {}", response.status());
    println!("Response: {:?}", response.into_string()?);

    Ok(())
}
Image
error[E0599]: no method named `into_string` found for struct `Response` in the current scope
 --> src/main.rs:6:41
  |
6 |     println!("Response: {:?}", response.into_string()?);
  |                                         ^^^^^^^^^^^ method not found in `Response<Body>`

Expected behavior

The code should compile and run without any issues.

Image

Image: uses ureq-2.12.1

Device Info (The device where you encountered this issue)

  • OS: MacOS
  • Version: Sequoia Version 15.3.2 (24D81)

Flutter Doctor

[✓] Flutter (Channel stable, 3.29.2, on macOS 15.3.2 24D81 darwin-arm64, locale en-US) [2.3s]
    • Flutter version 3.29.2 on channel stable at /Users/udhayxd/tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c236373904 (10 days ago), 2025-03-13 16:17:06 -0400
    • Engine revision 18b71d647a
    • Dart version 3.7.2
    • DevTools version 2.42.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [6.0s]
    • Android SDK at /Users/udhayxd/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [2.6s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [12ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2) [12ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[✓] VS Code (version 1.98.2) [10ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.106.0

[✓] Network resources [1,192ms]
    • All expected network resources are available.

• No issues found!
@Udhay-Adithya Udhay-Adithya added the bug Something isn't working label Mar 23, 2025
@Udhay-Adithya
Copy link
Contributor Author

Hey @ashitaprasad let me know if you want me to work on this issue and make a PR solving it.

@badnikhil
Copy link
Contributor

it worked fine in github codespace..

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

I used this for installation..

@Udhay-Adithya
Copy link
Contributor Author

it worked fine in github codespace..

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

I used this for installation..

Thanks for the suggestion, but this issue is unrelated to the Rust installation. The error occurs because the into_string() method was removed in ureq 3.x, and the code generator needs to be updated. The Rust toolchain itself is working correctly.

@ashitaprasad
Copy link
Member

You can send across a PR.

@ashitaprasad
Copy link
Member

But, @Udhay-Adithya it is high time I will recommend you to send a PR aligned to a project instead of working on side items right now.

@animator animator removed the bug Something isn't working label Mar 29, 2025
@badnikhil
Copy link
Contributor

badnikhil commented Apr 6, 2025

@Udhay-Adithya Apologies for the oversight! I just realized that in my Cargo.toml, the ureq dependency was set to version 2.9. Also,,I primarily use VS Code extensions for only two languages, since I work with multiple languages regularly.

Thanks to the documentation you shared I've updated the codegen accordingly and will open a PR after I finish updating the tests.

@badnikhil badnikhil linked a pull request Apr 7, 2025 that will close this issue
7 tasks
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 a pull request may close this issue.

4 participants