Angular object contains an unidentified property

While trying to send an object to the backend, I encountered an UnrecognizedPropertyException. Upon inspecting the object on both the frontend and backend, they appear to be identical.

However, upon checking the object in the frontend console, I discovered an additional property that is not defined anywhere in the project (I even searched for it in IntelliJ using ctrl + shift + f).

This unknown property existed in the object at some point in the past, so is it possible that it is somehow cached?

I have attempted to clear the cache, invalidate cache in IntelliJ, and run npm clean-install, but the issue persists.

How can I determine the source of this unexpected property in the object?

@JsonIgnoreProperties is not a viable solution in this scenario...

Frontend object (Angular 8 + Typescript 2.6.2):

export class ItemEto extends AbstractEto {
    item1: number;
    item2: number;
}

export class AbstractEto {
    id: number;
    modificationCounter: number;
}

Backend object (Java 8):

public class ItemEto extends AbstractEto {
    private long item1;
    private long item2;
}

public class AbstractEto {
    private long id;
    private long modificationCounter;
}

Object in console (JSON):

{
    "ItemEto": {
        "item1": 1,
        "item2": 2,
        "otherUnknownProperty": {
            "item3": null;
        },
    }
}

Answer №1

Make sure to include the "Unknown" property in the AbstractEto class or ensure that you correctly link the object to the ItemEto before including it in the response.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for creating a state change function using TypeScript

Imagine the temperature remains constant for 20 minutes, but at the 21st minute, it changes. The state change is determined by a programmable state change function. How can I create a function to calculate the difference in state change? if(data.i ...

How to extract a String value using Selenium's XPath in Java

I'm trying to figure out how to extract the value 14.84 for "purchaseTotal". This value can vary depending on the item price, so it's not a fixed amount. Basically, I need to capture the total of an order that is indicated by the value attribute ...

Tips for updating Ref objects in React

In the process of fixing a section of my project, I'm encountering an issue where I have no control over how refs are being utilized. The Editable text elements are currently handled through refs and a state variable within the component that holds al ...

Triggering createEffect in SolidJS with an external dependency: A guide

Is there a way to use an external dependency to trigger the createEffect function in Solid, similar to React's useEffect dependency array? I am trying to execute setShowMenu when there is a change in location.pathname. const location = useLocation() ...

Retrieving Text from a Disabled Input Field Using Selenium

Having trouble retrieving text from a disabled input field using Selenium in Java. I have attempted: element.getAttribute("disabled") ==> it returns True. element.getText() ==> it returns Null (String) ((JavascriptExecutor) driver).executeScript(" ...

Excluding specific parameter values in Angular Route configuration---Is it possible to exclude certain parameter values

I've set up my route like this const routes: Routes = [ { path: ':id', component: PickUpWrapperComponent, resolve: { request: PickupRequestResolverService }, children: [ { path: '', component ...

Leverage the VTTCue Object in an Angular2 project using Typescript

I am looking to dynamically load subtitles onto a video. let subs:TextTrack = video.addTextTrack('subtitles'); for (let dataSrt of dataSrts) { let cue: any = new VTTCue( dataSrt['startTime'], da ...

Cannot convert a Java.lang.String value to a JSONObject in JSON format

I have been working with an API (link here) that provides a JSON response. Recently, I encountered an issue while parsing this JSON data. It was functioning properly earlier, but something seems to have changed either in my API or Java code. Below is the ...

Encountering an issue with compiling Angular due to a Type Inference error

interface Course { name: string; lessonCount: number; } interface Named { name: string; } let named: Named = { name: 'Placeholder Name' }; let course: Course = { name: 'Developing Apps with Angular', lessonCount: 15 }; named = ...

Retrieving information from a JSON reply within an Angular 2 service

I am currently utilizing a service in angular 2 that retrieves JSON data from an API (). The code for fetching the data is depicted below: getImages() { return this.http.get(`${this.Url}`) .toPromise() .then(response => response.json() ...

Issue encountered while executing Storm topology on local machine

I am interested in testing a Storm topology by running it in local mode. The main objective of the project is to extract logs from a Kafka spout, perform some pre-processing tasks, and then display the content on the screen. Below is the code for my topol ...

Validate prop must consist of one of two functional components

I am looking to ensure that a prop can only be one of two different components. Here is what I currently have: MyComponent.propTypes { propA: PropTypes.oneOfType([ PropTypes.instanceOf(ClassComponentA) PropTypes.instanceOf(ClassCompon ...

Angular triggers a reload of iframe content whenever there is a manipulation of the DOM

One of the challenges I'm facing is with dynamically loading an iframe when a specific condition is met. <div *ngIf="iframeData"> <iframe [src]="sanitizer.bypassSecurityTrustResourceUrl(iframeData.iFrameUrl)" name="paymetricIFr ...

`How can I sort information based on a chosen parameter?`

Is it possible to combine the two conditions into one within the function onSelectedReport()? Representing these conditions in HTML would result in: HTML: <div *ngFor="let report of reports"> <div *ngFor="let i of income"> <di ...

What are the steps to create a dictionary app utilizing the Oxford Dictionary API?

The code snippet provided in the documentation returns a JSON result, but I am only interested in extracting the meaning of the word. Can someone guide me on how to specifically extract the meaning without fetching the entire JSON file? As a beginner in an ...

Having difficulty authenticating a JWT token in my Nextjs application

Help required with verifying a JWT token in Nextjs as I'm encountering the following error: TypeError: Right-hand side of 'instanceof' is not an object See below for the code I am currently using: useEffect(() => { let token = localS ...

Accessing environment-based constants in TypeScript beyond the scope of Cypress.env()Is there a way to gain access to environment-specific constants

Imagine I have an API test and the URL and Credentials are different between production and development environments: before("Authenticate with auth token", async () => { await spec().post(`${baseUrl}/auth`) .withBody( { ...

Failed to decipher an ID token from firebase

I'm feeling extremely frustrated and in need of assistance. My goal is to authenticate a user using Google authentication so they can log in or sign up. Everything worked perfectly during development on localhost, but once I hosted my app, it stopped ...

How to retrieve data from a JSON file in Angular 2 using the http get

I am encountering an issue while trying to access a json file using http get. The error message I receive is as follows: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterable ...

Enhancing Angular2 performance when managing a large number of input elements with two-way binding

My current project involves a component that resembles a spreadsheet, with numerous elements using two-way binding [(ngModel)] to a mutable object. However, when the number of inputs exceeds 100, the UI starts to slow down. After profiling the application ...