Skip to content

Feature/Support for QueryValue as a object #11787

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

Open
wants to merge 44 commits into
base: 4.9.x
Choose a base branch
from

Conversation

MarianConstantinMarica
Copy link

No description provided.

@CLAassistant
Copy link

CLAassistant commented Apr 28, 2025

CLA assistant check
All committers have signed the CLA.

@yawkat yawkat requested a review from dstepanov April 28, 2025 19:02
@yawkat
Copy link
Member

yawkat commented Apr 28, 2025

@dstepanov can you think of a better way to do this? otherwise i think it's ok

BeanIntrospection<T> introspection = introspectionOpt.get();
T instance;
try {
instance = introspection.instantiate();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why no-args constructor is required? I'think you need more tests with record and required args constructor (without no-arg)

Choose a reason for hiding this comment

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

I will update!

return BindingResult.unsatisfied();
}

BeanIntrospection<T> introspection = introspectionOpt.get();
Copy link
Contributor

@graemerocher graemerocher Apr 29, 2025

Choose a reason for hiding this comment

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

this should be altered to use introspection.builder() so that records, immutable types, types with custom constructors etc. are supported.

Copy link
Contributor

Choose a reason for hiding this comment

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

When using IntrospectionBuilder API and finally call the build() method any exception should b caught and the conversion rejected with context.reject

Choose a reason for hiding this comment

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

I made the changes with the introspection.builder(). Seems to work for object with custom constructor but I made a test for record and don't work. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

this is because records are not supported in Groovy and you a rewriting the test in Groovy. Probably will be fixed by #11832

BeanIntrospection<T> introspection = introspectionOpt.get();
BeanIntrospection.Builder<T> introspectionBuilder = introspection.builder();

for (BeanProperty<T, Object> property : introspection.getBeanProperties()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

iterative here over the getBuilderArguments() using array iteration to obtain the index

Optional<Object> converted = conversionService.convert(value.get(), context.with(property.asArgument()));
if (converted.isPresent()) {
try {
introspectionBuilder.with(propertyName, converted.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

I tried with getBuilderArguments() iteration, still not working for the records

import io.micronaut.core.annotation.Introspected;

@Introspected
public record PaginationRequest(Integer page, Integer size) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

@MarianConstantinMarica just rename PaginationRequest.java to PaginationRequest.groovy and after this all must work correctly

sdelamo and others added 11 commits June 10, 2025 09:34
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
# Conflicts:
#	gradle.properties
#	inject-java/src/test/resources/META-INF/services/io.micronaut.inject.visitor.TypeElementVisitor
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ronaut-projects#11880)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…icronaut-projects#11896)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-projects#11899)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
graemerocher and others added 23 commits June 26, 2025 08:14
# Conflicts:
#	gradle.properties
…ec to better reflect its actual contents. (micronaut-projects#11874)

The default order of an object in OrderUtil.getOrder should be
zero not LOWEST_PRECEDENCE, as otherwise there is no way to
request a bean be last in the list. The intention here is to
leave a bean that doesn't request an order un-ordered relative
to other beans, so zero is the correct value.

Apply a global ordering to all bean event listeners regardless
of requested generic type. Previously, listeners were ordered
only relative to other listeners that specified the same generic
type, meaning the final ordering could be unexpected in cases
where supertypes were matched. Ordering is now done after all
the listeners are aggregated.
…ronaut-projects#11909)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…180 (micronaut-projects#11903)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…cronaut-projects#11922)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…11927)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
… to v1.6.16 (micronaut-projects#11940)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ects#11934)

* Add new OutputStream buffer method to ByteBodyFactory
This will be useful for micronaut-jax-rs optimizations.

* CR
…11945)

* fix(deps): update netty monorepo to v4.2.3.final

* remove obsolete deletions

* build time init

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: yawkat <jonas.konrad@oracle.com>
)

This PR adds support for loading PEM files in place of key and trust stores.

- Introduce a PemParser class that can load various PEM types: PKCS#8 private keys (possibly encrypted), PKCS#1 private keys, SEC.1 elliptic curve keys, X.509 certificates. This is a bit complicated because we need to do some content sniffing.
- If key store loading fails from a path, also try loading it as PEM. For key stores, the expected format is a single PRIVATE KEY followed by some CERTIFICATEs, while for a trust store it expects a set of CERTIFICATEs.
- Add properties to KeyStoreConfiguration for separate key and certificate files, since keeping them separate is more common in practice (incl. in the docs)
- Update docs
…181 (micronaut-projects#11953)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…icronaut-projects#11946)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-projects#11959)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants