Skip to content

[REQ][Java] useRecords beyond Spring: shared logic and the java client #25494

Open

Description

@Sekator778

#10490 asks for Java models as records. useRecords for Spring is on master for 7.27.0, with allOf open in #25492. I'd like to offer the same option in the java client: restclient, webclient and native first, okhttp-gson last, one library per PR.

flowchart LR
  H["record decision in one helper"] --> S["spring: on master"]
  H --> J["java client: library by library"]
Loading

The first PR only moves that decision out of SpringCodegen, and regenerating the samples must change no file; the other Java generators never reach it. Gson is untried, and if this doesn't fit, useRecords stays Spring-only. @martin-mfg @KannaKim @Zomzog, go or no-go before I start?

Activity

  1. KannaKim commented on Oct 31, 2026

    @KannaKim
    Contributor

    This sounds like a good update to me. Do you have any thought on this @wing328

  2. jpfinne commented on Nov 1, 2026

    @jpfinne
    Contributor

    A small improvement: Add java 17 support to JavaFileAssert. This can be done by upgrading javaparser-core to 3.28.2.
    in JavaFileAssert:

    public static ParserConfiguration JAVA_17 = new ParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_17);
    
        public static JavaFileAssert assertThat(ParserConfiguration parserConfiguration, final Path path) {
            ParserConfiguration oldParserConfiguration = StaticJavaParser.getParserConfiguration();
            try {
                StaticJavaParser.setConfiguration(parserConfiguration);
                return new JavaFileAssert(StaticJavaParser.parse(path));
            } catch (IOException | ParseProblemException e) {
                throw new RuntimeException("Exception while reading file: " + path, e);
            } finally {
                StaticJavaParser.setConfiguration(oldParserConfiguration);
            }
        }
    
        public JavaFileAssert isRecord() {
            Assertions.assertThat(actual.getType(0).asClassOrInterfaceDeclaration())
                    .withFailMessage("Expected type %s to be a record", actual.getType(0).getName().asString())
                    .extracting(ClassOrInterfaceDeclaration::isRecordDeclaration)
                    .isEqualTo(true);
            return this;
        }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions