Giter Club home page Giter Club logo

Comments (5)

SidneyAllen avatar SidneyAllen commented on August 20, 2024

Hi @ksaritek

We are aware that standard code generators don't handle the MS Dateformat that we return from our Accounting APIs.

We are building our SDKs from these OpenAPI specs and have modified our mustache templates to work around these and convert them into native date or date-time. We do have plans to remove the format: date and format: date-time in the future so these would be simple "strings". This change isn't happening yet as we need to modify our mustache templates for 5 SDKs to use vendorExtensions and not rely on the format:date and date-time.

Of course, once the change is done you'd still have to handle the conversion of these strings into dates, but it should allow for code generation.

Final caveat, our Accounting API is over a decade old and predates Swagger and OpenAPI specs. For this reason, we've been reverse engineering these specs. There are inherent quirks in our APIs that are not easily addressed in OpenAPI specs and therefore your mileage may vary when using an off the shelf code generator.

from xero-openapi.

ksaritek avatar ksaritek commented on August 20, 2024

Hi @SidneyAllen, Thanks for the reply. So I will do the same modification for the GoLang, right?

Final caveat, our Accounting API is over a decade old and predates Swagger and OpenAPI specs. For this reason, we've been reverse engineering these specs. There are inherent quirks in our APIs that are not easily addressed in OpenAPI specs and therefore your mileage may vary when using an off the shelf code generator.

Up to your comment, should I continue with OpenAPI specs or not? I confused a little bit.

from xero-openapi.

SidneyAllen avatar SidneyAllen commented on August 20, 2024

@ksaritek - Not sure what you mean by same modification. If you have access to the mustache templates you are using to generate the code, then YES, you can make modifications. Some folks are using online code generators and don't have that option.

In the near term, if you want to fork this repo and wish to find and remove all format: date and format: date-time you are free too. We will be making that change in the future.

Yes, you can continue to use the OpenAPI spec, but I want to be fully transparent that there are quirks in the API - but for the most part it should work (heck we are using it to generate our SDKs 😄 )

For example our Invoices endpoints supports getting and invoice as JSON OR as a PDF. But with strongly typed language you need to pick one and OpenAPI spec only allows a path to be defined once in a spec.

So, "getInvoiceAsPDF" is a method that uses the path /invoices/{invoiceID}/pdf (and we added a vendor extension x-path: /invoices/{invoiceID}. In our template if x-path exists, we substitute it for the defined path.

I'm not trying to worry you because the spec should mostly work for you and using standard templates (once the date issue is sorted) but there may be other things we've worked around.

Hope that clarifies things.

from xero-openapi.

ksaritek avatar ksaritek commented on August 20, 2024

👍 yep that clarifies things

from xero-openapi.

SidneyAllen avatar SidneyAllen commented on August 20, 2024

@ksaritek - hope you are well.

I've begun work to changing MSJSON dates into just Strings in our OpenAPI spec.

Here is my work in progress - branch
https://github.com/XeroAPI/Xero-OpenAPI/tree/accounting-date-as-string

In the future we'll merge this into master, but I don't have an ETA yet.

from xero-openapi.

Related Issues (20)

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.