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

Add Support for BigInteger / BigDecimal #312

Open
rcoh opened this issue Apr 17, 2021 · 4 comments
Open

Add Support for BigInteger / BigDecimal #312

rcoh opened this issue Apr 17, 2021 · 4 comments

Comments

@rcoh
Copy link
Collaborator

rcoh commented Apr 17, 2021

No description provided.

@barbu110
Copy link
Contributor

Can we use the rug crate? seems like a pretty mature crate on top of GNU libraries.

@rcoh
Copy link
Collaborator Author

rcoh commented Apr 30, 2021

I probably wouldn't pull in a crate that appears to be bound to a c library as my first choice, personally. But worth looking into.

This isn't especially high priority, I don't think there are an AWS models that use these shapes.

@timClicks
Copy link
Contributor

To move forward with this, I recommend pulling in the num crate. It's pure Rust, well vetted and openly licensed.

@Velfi Velfi added good first issue Good for newcomers low-priority labels Sep 8, 2022
@Velfi
Copy link
Contributor

Velfi commented Sep 8, 2022

This would involve:

  • Deciding whether or not we want to expose num types in our public API. It would be safer and more future-proof for us to newtype them instead.
  • Updating SymbolVisitor.kt something like this:
    override fun bigIntegerShape(shape: BigIntegerShape?): Symbol {
        return symbolBuilder(RustType.Opaque(name = "BigInt", namespace = "num_bigint"))
            .addDependency(NumBigInt).build()
    }
    
    override fun bigDecimalShape(shape: BigDecimalShape?): Symbol {
        return symbolBuilder(RustType.Opaque(name = "BigRational", namespace = "num_rational"))
            .addDependency(NumRational).build()
    }
    
  • Updating CargoDependency.ky like this:
     val NumBigInt: CargoDependency = CargoDependency("num-bigint", CratesIo("0.4.3"))
     val NumRational: CargoDependency = CargoDependency("num-rational", CratesIo("0.4.1"))
    
  • Adding tests to ensure that we generate structs correctly when a smithy model specifies these new types

ogghead pushed a commit to ogghead/smithy-rs that referenced this issue Apr 26, 2024
ogghead pushed a commit to ogghead/smithy-rs that referenced this issue May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants