|
59 | 59 | import org.springframework.data.rest.core.mapping.ResourceMappings; |
60 | 60 | import org.springframework.data.rest.core.mapping.ResourceMetadata; |
61 | 61 | import org.springframework.data.rest.webmvc.RestMediaTypes; |
| 62 | +import org.springframework.data.util.TypeInformation; |
62 | 63 | import org.springframework.hateoas.server.LinkRelationProvider; |
63 | 64 | import org.springframework.util.CollectionUtils; |
64 | 65 |
|
@@ -118,22 +119,21 @@ public SpringDocDataRestUtils(LinkRelationProvider linkRelationProvider, Reposit |
118 | 119 | */ |
119 | 120 | public void customise(OpenAPI openAPI, ResourceMappings mappings, PersistentEntities persistentEntities) { |
120 | 121 |
|
121 | | - persistentEntities.getManagedTypes().stream().forEach(typeInformation -> |
122 | | - { |
123 | | - Class domainType = typeInformation.getType(); |
124 | | - ResourceMetadata resourceMetadata = mappings.getMetadataFor(domainType); |
125 | | - final PersistentEntity<?, ?> entity = persistentEntities.getRequiredPersistentEntity(domainType); |
126 | | - EntityInfo entityInfo = new EntityInfo(); |
127 | | - entityInfo.setDomainType(domainType); |
128 | | - List<String> ignoredFields = getIgnoredFields(resourceMetadata, entity); |
129 | | - if (!repositoryRestConfiguration.isIdExposedFor(entity.getType())) |
130 | | - entityInfo.setIgnoredFields(ignoredFields); |
131 | | - List<String> associationsFields = getAssociationsFields(resourceMetadata, entity); |
132 | | - entityInfo.setAssociationsFields(associationsFields); |
133 | | - entityInoMap.put(domainType.getSimpleName(), entityInfo); |
134 | | - } |
135 | | - ); |
136 | | - |
| 122 | + for (PersistentEntity<?, ? extends PersistentProperty<?>> persistentEntity : persistentEntities) { |
| 123 | + TypeInformation<?> typeInformation = persistentEntity.getTypeInformation(); |
| 124 | + Class domainType = typeInformation.getType(); |
| 125 | + ResourceMetadata resourceMetadata = mappings.getMetadataFor(domainType); |
| 126 | + final PersistentEntity<?, ?> entity = persistentEntities.getRequiredPersistentEntity(domainType); |
| 127 | + EntityInfo entityInfo = new EntityInfo(); |
| 128 | + entityInfo.setDomainType(domainType); |
| 129 | + List<String> ignoredFields = getIgnoredFields(resourceMetadata, entity); |
| 130 | + if (!repositoryRestConfiguration.isIdExposedFor(entity.getType())) |
| 131 | + entityInfo.setIgnoredFields(ignoredFields); |
| 132 | + List<String> associationsFields = getAssociationsFields(resourceMetadata, entity); |
| 133 | + entityInfo.setAssociationsFields(associationsFields); |
| 134 | + entityInoMap.put(domainType.getSimpleName(), entityInfo); |
| 135 | + } |
| 136 | + |
137 | 137 | openAPI.getPaths().entrySet().stream() |
138 | 138 | .forEach(stringPathItemEntry -> { |
139 | 139 | PathItem pathItem = stringPathItemEntry.getValue(); |
|
0 commit comments