Skip to content

Fixes clone method of CodegenProperty - #7928

Closed
spacether wants to merge 2 commits into
OpenAPITools:masterfrom
spacether:fix_CodegenProperty_clone
Closed

Fixes clone method of CodegenProperty#7928
spacether wants to merge 2 commits into
OpenAPITools:masterfrom
spacether:fix_CodegenProperty_clone

Conversation

@spacether

@spacether spacether commented Nov 12, 2020

Copy link
Copy Markdown
Contributor

The clone method for CodegenProperty was maintaining references to additionalProperties, items, vars, and requiredVars
This PR updated the method so those properties are cloned

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

Core Team Members
@wing328 (2015/07) ❤️
@jimschubert (2016/05) ❤️
@cbornet (2016/05)
@ackintosh (2018/02) ❤️
@jmini (2018/04) ❤️
@etherealjoy (2019/06)
@spacether (2020/05)

@spacether spacether added this to the 5.0.0 milestone Nov 12, 2020
@spacether spacether changed the title Updates clone method Fixes clone method of CodegenProperty Nov 12, 2020
@wing328

wing328 commented Dec 7, 2020

Copy link
Copy Markdown
Member

Looks like this will result in some changes in Haskell client generator:

There are uncommitted changes in working tree after execution of 'bin/ensure-up-to-date'
Perform git diff
diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs
index 53327dc686..466ea2ecd4 100644
--- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs
+++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs
@@ -2013,8 +2013,8 @@ mkXmlItem =
 
 -- | Enum of 'Text'
 data E'ArrayEnum
-  = E'ArrayEnum'Fish -- ^ @"fish"@
-  | E'ArrayEnum'Crab -- ^ @"crab"@
+  = E'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnum'Fish -- ^ @"fish"@
+  | E'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnum'Crab -- ^ @"crab"@
   deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
 
 instance A.ToJSON E'ArrayEnum where toJSON = A.toJSON . fromE'ArrayEnum
@@ -2026,14 +2026,14 @@ instance MimeRender MimeMultipartFormData E'ArrayEnum where mimeRender _ = mimeR
 -- | unwrap 'E'ArrayEnum' enum
 fromE'ArrayEnum :: E'ArrayEnum -> Text
 fromE'ArrayEnum = \case
-  E'ArrayEnum'Fish -> "fish"
-  E'ArrayEnum'Crab -> "crab"
+  E'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnum'Fish -> "fish"
+  E'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnum'Crab -> "crab"
 
 -- | parse 'E'ArrayEnum' enum
 toE'ArrayEnum :: Text -> P.Either String E'ArrayEnum
 toE'ArrayEnum = \case
-  "fish" -> P.Right E'ArrayEnum'Fish
-  "crab" -> P.Right E'ArrayEnum'Crab
+  "fish" -> P.Right E'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnum'Fish
+  "crab" -> P.Right E'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnumE'ArrayEnum'Crab
   s -> P.Left $ "toE'ArrayEnum: enum parse failure: " P.++ P.show s
 
 
@@ -2216,8 +2216,8 @@ toE'EnumString = \case
 
 -- | Enum of 'Text'
 data E'Inner
-  = E'Inner'UPPER -- ^ @"UPPER"@
-  | E'Inner'Lower -- ^ @"lower"@
+  = E'InnerE'InnerE'InnerE'InnerE'Inner'UPPER -- ^ @"UPPER"@
+  | E'InnerE'InnerE'InnerE'InnerE'Inner'Lower -- ^ @"lower"@
   deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
 
 instance A.ToJSON E'Inner where toJSON = A.toJSON . fromE'Inner
@@ -2229,14 +2229,14 @@ instance MimeRender MimeMultipartFormData E'Inner where mimeRender _ = mimeRende
 -- | unwrap 'E'Inner' enum
 fromE'Inner :: E'Inner -> Text
 fromE'Inner = \case
-  E'Inner'UPPER -> "UPPER"
-  E'Inner'Lower -> "lower"
+  E'InnerE'InnerE'InnerE'InnerE'Inner'UPPER -> "UPPER"
+  E'InnerE'InnerE'InnerE'InnerE'Inner'Lower -> "lower"
 
 -- | parse 'E'Inner' enum
 toE'Inner :: Text -> P.Either String E'Inner
 toE'Inner = \case
-  "UPPER" -> P.Right E'Inner'UPPER
-  "lower" -> P.Right E'Inner'Lower
+  "UPPER" -> P.Right E'InnerE'InnerE'InnerE'InnerE'Inner'UPPER
+  "lower" -> P.Right E'InnerE'InnerE'InnerE'InnerE'Inner'Lower
   s -> P.Left $ "toE'Inner: enum parse failure: " P.++ P.show s
 
 
Perform git status
On branch spacether-fix_CodegenProperty_clone
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs

no changes added to commit (use "git add" and/or "git commit -a")

so we'll need to look into the haskell client generator later to find out more first.

@wing328 wing328 modified the milestones: 5.0.0, 5.0.1 Dec 21, 2020
@spacether spacether closed this Jan 13, 2021
@spacether

Copy link
Copy Markdown
Contributor Author

Not interested in continuing effort here at this time

@spacether
spacether deleted the fix_CodegenProperty_clone branch December 28, 2021 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants