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

datetime and dateOnly types should be mapped to TypeScript Dat #72

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.vrap.rmf.codegen.types

import com.google.inject.Inject
import com.google.inject.name.Named
import io.vrap.rmf.codegen.di.VrapConstants
import io.vrap.rmf.raml.model.modules.Library
import io.vrap.rmf.raml.model.resources.Method
import io.vrap.rmf.raml.model.resources.Resource
Expand Down Expand Up @@ -67,11 +66,11 @@ class PackageProvider @Inject constructor(

private inner class ResourcePackageSwitch : ResourcesSwitch<String>() {
override fun caseMethod(`object`: Method): String {
return "$clientPackage.resource"
return "$clientPackage"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was required because it broke our current code, don't know why we added this in the first place.

}

override fun caseResource(`object`: Resource?): String {
return "$clientPackage.resource"
return "$clientPackage"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was required because it broke our current code, don't know why we added this in the first place.

}

override fun defaultCase(`object`: EObject): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ object TypeScriptBaseTypes : LanguageBaseTypes(
doubleType = nativeTypeScriptType("number"),
stringType = nativeTypeScriptType("string"),
booleanType = nativeTypeScriptType("boolean"),
dateTimeType = nativeTypeScriptType("string"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one wouldn't work since the string date is interpreted as string so trying to call a date method will induce type error.

dateOnlyType = nativeTypeScriptType("string"),
dateTimeType = nativeTypeScriptType("Date"),
dateOnlyType = nativeTypeScriptType("Date"),
timeOnlyType = nativeTypeScriptType("string")
)

Expand Down