ebowman/api-first-hand

Type Naming of Basic Types

jona7o opened this issue · 1 comments

Hi zalando-team,

i used a swagger file of a current project to evaluate the plugin for this project. It's very awesome, but i have got a problem with the type names and i don't know how to fix it.

When i have optional basic types the plugin creates something like this:

type CompanyFinancialInstitution = Option[String] type AddressPostalCode = Option[Int] type CorrespondenceIncoming = Option[Boolean]

Now when i create another Definition with a lot of optional properties the case class looks horrible.
It would be very nice, when the Basic Optional Types would look like this or are regenerated every time for every parameter

type OptionalString = Option[String] type OptionalInt = Option[Int] type OptionalBoolean = Option[Boolean]

e.g. this snippet
TodoTask: type: object properties: guid: type: string responsible: type: string todoTaskDate: type: string format: date activity: type: string notes: type: string description: at work attachment: type: string description: at work owningCompanyGuid: type: string owningPersonGuid: type: string created: type: string format: datetime modified: type: string format: datetime

generates a horrible case class:

case class TodoTask(owningCompanyGuid: CompanyFinancialInstitution, guid: CompanyFinancialInstitution, responsible: CompanyFinancialInstitution, owningPersonGuid: CompanyFinancialInstitution, modified: CompanyFinancialInstitution, attachment: CompanyFinancialInstitution, notes: CompanyFinancialInstitution, todoTaskDate: CorrespondenceCorrespondenceDate, activity: CompanyFinancialInstitution, created: CompanyFinancialInstitution)

Greetings from South-Germany
Tobias

s12v commented

@jona7o, same issue here: #58. We're working on a PR now, the idea is to have no type aliases for things like Option[T]