Code Monkey home page Code Monkey logo

Comments (14)

Irev-Dev avatar Irev-Dev commented on August 20, 2024

@jessfraz, I think there might be an issue with the sdk for the mass and volume, either that or I'm not using it correctly.
I added get_volume.py and get_mass.py and functions for the new endpoints return very similar errors.

Error(error_code=<kittycad.types.Unset object at 0x7f4791aa6d90>, message='unable to parse query string: missing field `src_format`', request_id='96a9e6f1-bb24-4be0-827d-176251cde478', additional_properties={})

and

Error(error_code=<kittycad.types.Unset object at 0x7fe68ec4beb0>, message='unable to parse query string: missing field `src_format`', request_id='073782d6-4c1e-42c8-95e5-03eb6181ae77', additional_properties={})

respectively.

Might the SDK not be adding the query param?

see #32.

from litterbox.

Irev-Dev avatar Irev-Dev commented on August 20, 2024

Edit: looks like it's putting the format into the path not the query?
https://github.com/KittyCAD/kittycad.py/blob/main/kittycad/api/file/create_file_volume.py#L17

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

oh it very well could be! i can try and fix tomorrow

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

its likely somewhere around here: https://github.com/KittyCAD/kittycad.py/blob/main/generate/generate.py#L234

if you get to it before me

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

I fixed the go one

from litterbox.

Irev-Dev avatar Irev-Dev commented on August 20, 2024

Ah thanks!
I've started looking at the python one, and I think I was wrong with my original guess about it being put into the path. Not sure where the problem is.

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

oh thats it tho! It needs a check for if its in the query or the path, essentially its trying to add it to the path but failing since there are no more vars!

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

this is a dumb diff i have so far but its not adding the query yet:

+    in_query = []
     if 'parameters' in endpoint:
         parameters = endpoint['parameters']
         for parameter in parameters:
@@ -246,12 +247,16 @@ response: Response[""" + success_type + """] = await """ + fn_name + """.asyncio
             else:
                 print("  parameter: ", parameter)
                 raise Exception("Unknown parameter type")
-            f.write(
-                ", " +
-                parameter_name +
-                "=" +
-                camel_to_snake(parameter_name))
+            if parameter['in'] == 'path'
+                f.write(
+                    ", " +
+                    parameter_name +
+                    "=" +
+                    camel_to_snake(parameter_name))
+            elif parameter['in'] == 'query'
+                in_query.push(parameter)
     f.write(")\n")
+    # Now we add the parameters to the query if there are any.
     f.write("\n")
     f.write("\theaders: Dict[str, Any] = client.get_headers()\n")

maybe that helps

also the makefile has some nice commands like make generate and make shell to pop you into a container w all the deps

from litterbox.

Irev-Dev avatar Irev-Dev commented on August 20, 2024

Ah okay

Thanks for the makefile tip, mostly trying to grok the repo at this point.

This is mostly likely useful context for when I get around to making the JS SDK.

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

from litterbox.

Irev-Dev avatar Irev-Dev commented on August 20, 2024

Hot tip: don't create a virtual python environment in the python SDK repo and expect make generate to still work 🤦

and yeah for sure, is this how code gen is normally done? tbh I was expecting AST related code, but I haven't every written openAPI code-gen, only used existing ones.

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

okay i released the new python version, thank you!

Yeah you can use an AST personally I just don't like them so I do a massive printf def not claiming its better but easier to work my head around haha

from litterbox.

jessfraz avatar jessfraz commented on August 20, 2024

im sure the AST people are like WTF lol

from litterbox.

Irev-Dev avatar Irev-Dev commented on August 20, 2024

Thank you!

And yeah fair enough. From memory the names for everything in AST land are not the most intuitive to say the least.

from litterbox.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.