in my model I have required property but when I do request from front I get an error like "Should NOT have additional properties" for the required field. Can you help me?
Model:
import {Entity, model, property} from '@loopback/repository';
@model()
export class InternalProjectServiceType extends Entity {
@property({
type: 'string',
id: true,
generated: true,
})
id?: string;
@property({
type: 'string',
required: true,
})
internalProjectId: string;
@property({
type: 'string',
})
serviceTypeId?: string;
constructor(data?: Partial<InternalProjectServiceType>) {
super(data);
}
}
export interface InternalProjectServiceTypeRelations {
// describe navigational properties here
}
export type InternalProjectServiceTypeWithRelations = InternalProjectServiceType & InternalProjectServiceTypeRelations;
i had the same issue. I was using Angular and nodejs then loopback for my apis. I noticed that case mattered. Eg in your case internalProjectId: string; and INTERNALPROJECTID: string; is different. In your logic you should make sure you are doing a post to the same case as your loopback model. If in your logic you post as internalProjectId and in your loopback model you declared INTERNALPROJECTID as a property, you'll get that error "Should NOT have additional properties" It is worth noting that i was using Loopback for.