swagger-api / swagger-api/swagger-codegen

[JAVASPRING] equals and hashCode for models with byte[] and binary strings

Open
#11,179 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The generated equals and hashcode methods for models with byte[] and binary strings use wrong methods. This was fixed for Java in https://github.com/swagger-api/swagger-codegen/pull/7341 but the bug remains when generating with -l spring

Swagger-codegen version

2.4.21

Command line used for generation

java -jar swagger-codegen-cli-2.4.21.jar generate -i swagger.json -l spring -DdateLibrary=legacy,hideGenerationTimestamp=true --model-package com.swagger.codegen.swagger.bean -o output

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/pull/7341

Suggest a fix/enhancement

The same fix from 7341 should work if applied to modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache, modules/swagger-codegen/src/main/resources/Java/pojo.mustache, and the script is run to update samples.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the fix in pull request 7341 with modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache and modules/swagger-codegen/src/main/resources/Java/pojo.mustache. Apply the equivalent template change, run the sample-update script, and verify that generated Spring models with byte[] and binary strings use the corrected equals and hashCode methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.