Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

java.time APIs and RAML Types #294

Closed
giacgbj opened this issue Aug 10, 2017 · 8 comments
Closed

java.time APIs and RAML Types #294

giacgbj opened this issue Aug 10, 2017 · 8 comments

Comments

@giacgbj
Copy link

giacgbj commented Aug 10, 2017

Is there a way to use java.time APIs (e.g. LocalDateTime, LocalDate and LocalTime, ecc.) with RAML Types like datetime, date-only, time-only, ecc.?

@chrisjamesconnor
Copy link

Hi - wondered if there was any answer to this? Other than doing some JavaPoet type work on our own ?

@jpbelang
Copy link
Contributor

Right now, it's java poet stuff. Which is a bit of a pain.

However, i'm working on a raml-to-pojo (which would be used by ramlforjaxrs) that would swap them out wholesale.

@chrisjamesconnor
Copy link

Excellent - I am currently working on specifying an approach for our applications. Would I be better waiting on this to bottom out (ie for you to finish this work).

I am currently using annotationTypes to map className properties so that we generate java.time.Local date (creating a ramltojaxrs.raml) file in the process.

This seems to work well for our use cases at this early stage. We are also using a similar technique to generate Lombok builder annotations (using your @depricated example as inspiration!). This allows us to generate builders on our generates Impl classes which is very useful with the layers of our apps.

Will this be maintained moving forward? Do you have another view regarding this approach?

@jpbelang
Copy link
Contributor

Ooooooh. Lombok. That's a great idea. Unfortunately, the RAML type have changed the way of writing plugins a bit.

As to changing the type, you can now (in release/2.2.0) change the type being used. You could check out this annotation:

#%RAML 1.0
title: Hello World API
version: v1
baseUri: https://api.github.com
mediaType: application/json
uses:
  ramltopojo: ramltopojo.raml
/search:
    description: The search resource
    uriParameters:
        id:
            type: date
            (ramltopojo.types):
              plugins:
                - name: core.changeType
                  arguments: [ java.time.LocalDate ]

@jpbelang jpbelang added this to Done in 3.0.0 Jan 29, 2018
@muthulingapandian
Copy link

Hi Belanger,

Where can i find the ramltopojo.raml? Please help.

Regards,
Muthu

@jstoiko jstoiko closed this as completed Mar 20, 2018
@muthulingapandian
Copy link

Thanks Belanger

Basically, ours is third-party RAML and not supposed to update it. So I tried another approach by adding MapperConfiguration in pom.xml as attached,

jsonMapperConfiguration.txt
But it is not working and generates date types in default java.uitl.Date. I am using raml-to-jaxrs-maven-plugin version 2.1.0. The plugin is internally using "jsonschema2pojo-core" module which supports this configuration. Can you please help on this?

Thank you

Regards,
Muthu

@kevinduffey
Copy link

Bit late.. but cant you write an overaly or extension raml to the raml you are not allowed to change.. so that you CAN modify it for your annotation use without affecting the base raml?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
3.0.0
  
Done
Development

No branches or pull requests

6 participants